How to replace any character that is not a letter or a digit with an underscore in a string?

Hi Guys,

Just wondering if there is a way to detect and replace in a string any character different than a number or letter? any idea?

Regex.replace(string,"[^\w\d]","")
Or
Regex.replace(string,"[^A-Z^a-z^\d]","
")

2 Likes

thank you very much

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.