I am developing a text highlighter in a file using the java regex pattern matching. Following is a code snapshot of it
SearchQuery=preprocessedModifiedArrayList.get(i)+[\\w\\s\\W]*?";
pattern = Pattern.compile(SearchQuery);
Matcher matcher = pattern.matcher(EXAMPLE_TEST);
in here "preprocessedModifiedArrayList.get(i)" contains the query to be searched in the text of the file. I have a problem that when the "preprocessedModifiedArrayList.get(i)" has "+" sign in it(example: if it is an equation) , it returns the dangling + exception.
I want to know how can I deal with this problem
"
-...+"[\\w\\s\\W]*?";
– MByD Aug 23 '11 at 16:05