Usage of String.replace?

@owaisqayum: You can use ^ (negation character) like:

sentence = "Hello, world ... 123 *** ^%&*())^% %%:>"
String.replace(sentence, ~r/[^0-9a-zA-Z ]/, " ")

Here is my another post with many helpful examples:

On pages for testing regular expressions you may find some references. For example here:

at the bottom of page you can search by not and you would have few interesting suggestions.

A CHARACTER NOT IN THE RANGE A-Z
[^a-z] Matches any characters except those in the range a-z.

/[^a-z]+/g
Anything but a-z.

4 Likes