I have a string and want to remove all non-symbolic characters (exclude ‘ ‘). So if I have a “some, – another” I want to get “some another”.
I can use s.gsub(/\W/, '') to remove all non-symbolic characters, but it remove spaces ‘ ‘ also.
I can use s.gsub(/\S/, '') to remove all non-spaces, but it removes all symbolic characters.
How can I combine this two conditions?
This should work: