String Pattern Matching
Hi,
I am working on a project that needs to identify a particular String from another String, however, the location where the match will occur is unknown. For example, I would want to identify a line that includes operators such as "++" or "--".
if (Pattern.matches("++", lineSplit[j])){
....//other irrelevant codes here.
}
wherelineSplit[j] is an element from an already set String array.
I'm considering usingPattern.matches for this, but it shows me a compiling error:
java.util.regex.PatternSyntaxException: Dangling meta character '+' near index 0
++
^
I've tried usingsplit too, but it shows a similar error.
The last resort would be to use other pattern matching algorithm to search the entire document, but it would be MUCH, MUCH less efficient to code. Is there any way to solve this? or do I have to brace myself for the new RAM chip I'll be needing for this?

