In one of my scenario , I wanted to replace specific strings mentioned below.
String S1 = "1.This is example of regex and call the mobile 400-199-1234.This statement is valid.2.This is second example of regex.10.This is tenth statement";
In the above string I wanted to replace 1., 2., 10. (only) with null value.
The String should like this
String S1 = "This is example of regex and call the mobile 400-199-1234.This statement is valid. This is second example of regex.This is tenth statement";
I have tried using the below regex - "[0-9]\\."
My Code looks like: S1=S1.replaceAll("[0-9]\\.","")
It replaces all values including the mobile number and the string looks like this:
String S1 = "This is example of regex and call the mobile 400-199-123This statement is valid. This is second example of regex.This is tenth statement";
Can someone help with regex?