0

Which is the Regex for these symbols?

-, , %, /, ., "", «», '', ', <, >, &, :, (, ), !, ^, *

Ι need to Replace them all with Space.

2

Try

String r = t.replaceAll('[-%/.<>&:]',' '); 

// Put all your symbols here.

Example:

String t = 'I-am%Noor/who/are:you<I>am';
String r = t.replaceAll('[-_%/."<>&:()!/*/^]',' ');
System.Debug(r);

Output:

I am Noor who are you I am
1

Just adding another option here: you can utilize some great playground tools to figure it our or test out your regex before putting it into your code.

https://regexr.com/

and then a great resource for learning regex as well

https://regexone.com/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.