Reputation: 28
I'm currently working on a UIMA based project, and the data set I am using has some predefined plain-text annotations that I am trying to convert into UIMA annotations using the Matcher utility.
My problem is that the annotations are in the format [ANNO] [/ANNO], and I have no idea how to write '[' or ']' as a regular expression.
I tried searching various places, and couldn't find an answer to this, closest I could find is to use either the octal or hexidecimal value rendition, but I then can't actually find said rendition for the character.
Cheers
Upvotes: 0
Views: 144
Reputation:
As Dervall said, you must escape them:
Pattern pattern = pattern.compile("\\[");
Matcher matcher = pattern.matcher("string to match against");
Upvotes: 4