Remove all ANSI colors/styles from strings
I use a library that adds ANSI colors / styles to strings. For example: > "Hello World".rgb(255, 255, 255) '\u001b[38;5;231mHello World\u001b[0m' > "Hello World".rgb(255, 255, 255).bold() '\u001b[1m\u001b[38;5;231mHello World\u001b[0m\u001b[22m' When I do: console.log('\u001b[1m\u001b[38;5;231mHello World\u001b[0m\u001b[22m') a "Hello World" white and bold message will be output. Having a string like '\u001b[1m\u001b[38;5;231mHello World\u001b[0m\u001b[22m' how can these elements be removed? foo('\u001b[1m\u001b[38;5;231mHello World\u001b[0m\u001b[22m') //=> "Hello World" Maybe a good regular