I am trying to parse a string and want to replace All '(' with ' ( ' when I try to execute the following command
String s1 = '1AND( 2 OR 3 ) AND4 AND(5OR6)';
s1=s1.replaceAll( '(' , ' ( ' );
I get the following error
FATAL_ERROR System.StringException: Invalid regex: Unclosed group near index 1
When I try to use replace instead of replaceAll it works But I want to use replace all, please suggest me how to get it to work.