cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Replacing many special characters using one function one time

KTsnap
New Contributor III

Hi All,
I want to replace the following special characters : > % ? \ with space .
I do not want to use multiple replace function. Is it possible to do with one replace function.
Thanks for your time.

1 REPLY 1

AleksandarAngel
Contributor III

Hi @KTsnap,

Yes, it is possible to use the .replace() function with a given pattern (regex).

In your case this should do the job:
$str.replace(/:|>|%|\?|\\/g,' ')

Also, if you need additional info please check the replace() function documentation.

Let me know if this helps you.

BR,
Aleksandar.