Forum Discussion

KTsnap's avatar
KTsnap
New Contributor III
3 years ago

Replacing many special characters using one function one time

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

  • 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.