Hello,
Adding to the above post Pattern.quote () is only available Java 5.0. But you can find an equivalent 1.4 here, How to prevent regular expressions to interpret a substring? This enables you to avoid a possible special characters in your keys are not "break" your regexp When the elements surrounding the key, they can add constraints on the elements surrounding the chain (without taking into account the replacement)
Code:
* "(?<=\ \ p (pn) | \ \ p (sp) | ^)" :
"(?<=)"Lets you specify the above term. Here we allow only \ \ p (pn) | \ \ p (sp) | ^, Respectively: a punctuation, a whitespace or the start of the string.
* "(?=\ \ p (pn) | \ \ p (sp) | $)" Do the same thing, but for the following characters:
"(?=)"To specify the elements that follow the term. Here we allow only \ \ p (pn) | \ \ p (sp) | $, Respectively: a punctuation, a whitespace or the end of the chain.
Bookmarks