Pattern: illegal escape character
I have been trying to create a regular expression that effectively encompasses the following rules:
starts with \( or \[
ends with \) or \]
i came up with the following
However this produces and illegal escape character exception, prefixing it with two backslashes or none has the same effect and treats the "[" as an opening of a unity statement (probably not the official name) and a "]" as a closing.
Pattern latex = Pattern.compile(".\\[\[(](.+\\[)\");
Help would be appreciated.