function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MandadiMandadi 

Creating REGEX for replacing all special characters With Space except those between quotes

Hi All,

     I need to build a regular expression to replace all the special characters in the string with space except those between quotes.

Can any one help me what is the regular Expression for this....


Thanks,
Sure@DreamSure@Dream
Hi,


Can u give an example for what exactly u want?


Use the following to replace all special characters with space:
StringVariable=StringVariable.replaceAll('[^a-zA-Z0-9]',' ');
MandadiMandadi
    Hi,
     Brief explanation with an example for this post.        

For example,
           I have String like-  abc,"mnc!".'xyz.'

   
Now my requirement is replace all special characters with space except quotes and those between quotes ...

So i want to get result like-   abc "mnc!" 'xyz.'

 Can  u help me how to write Regex for this....


thanks,