I want to gsub all characters in a string that are not letters and replace with '#'. I think I need a regular expression that goes something like, "gsub() when this regex does not match."
Any ideas?
Look ma, no regex...
str.tr( '^A-Za-z', '#' )
str.gsub(/[^a-zA-Z]/, '#')
The ^ means doesn't match
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