I have a set of regular expressions that need to be applied to a String set,
For example:
- all multiple spaces with one space
("\s{2,}" --> " ") - everything. and then char c. followed by a space followed by char
(\.([a-zA-Z]-->". $1")
So, I will have something like this:
String s="hello .how are you?";
s=s.replaceAll("\\s{2,}"," ");
s=s.replaceAll("\\.([a-zA-Z])",". $1");
....
it works, however, imagine that I am trying to replace more than 100 such expressions with a long string. it is useless to say how slowly it can be.
so my question is is there a more efficient way to generalize these replacements with single replaceAll (or something similar like Pattern / Matcher for example)
I followed Java Replacing several different ... ,
but the problem is that my regular expressions are not simple Strings.