Pattern: illegal escape character
Hi everyone,
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
Code:
Pattern latex = Pattern.compile(".\\[\[(](.+\\[)\[]");
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.
Help would be appreciated.
Thanks.