[Solved] Replace text between two symbol Sing through regex [closed]


Try with below code:

 String s="Example$for$string%is%notworking";
 s.replaceAll("[$&+,:;=?@#|'<>.^*()%!-]", "otherstring")

But in above approach we do not consider many of the special characters like some of DOS smilies like little angle and white smily face

So may need to try some thing opposite. which are characters you want to keep. some thing as below , i am taking A-Z, a-z and 0-9 as below:

s.replaceAll("[^A-Za-z0-9]", "otherstring")

1

solved Replace text between two symbol Sing through regex [closed]