Possible Duplicate:
Flex RegExp to Java RegExp
I don’t know why is it not working.. I’m using java..
...
String patternString = "([^{}]*{[^{}]+}[^{}])*";
Pattern p = Pattern.compile(patternString);
...
The error that i receive is:
Illegal repetition near index 4
([^{}]*{[^{}]+}[^{}]*)
You need to escape the literal braces unless they’re inside a character class:
Most other regex flavors can recognize when braces are not being used as a repetition operator (as in
[0-9]{1,3}) and therefore will parse the regex correctly. But Java is insistent on having these braces escaped.