How do I replace all non-word chars (\W) that are also not space characters (\s)?
This is the desired functionality:
"the (quick)! brown \n fox".gsub(regex, "#")
=>
"the #quick## brown \n fox"
"the (quick)! brown \n fox".gsub(/[^\w\s]/, "#")
By making the regex replace anything that is NOT a word character OR a space character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With