This content has been marked as final. Show 4 replies
871373 wrote:I don't think so. I did a few experiments and get the same results as you do on 1.6.0_26 and on the latest 1.7 snapshot. I even tried it using Pattern.quote() rather then "\ \Qxxxxxxxx\ \E" but get the same result.
Am I overlooking something?
I know very little about 'canonical equivalence' but since I expect one should be able to put anything between \ \Q and \ \E I do think you have found a bug and I think you should submit a bug report.
Edited by: sabre150 on 09-Jul-2011 01:00
In regular text the soddin forum software interprets two touching \ as a new line so I have had to put a space between them!
Thanks for the investigation, Sabre. Found another one along the same lines:
Pattern p = Pattern.compile("[\\r\\n\\\\]", Pattern.CANON_EQ);
Exception in thread "main" java.util.regex.PatternSyntaxException: Unclosed character class [\r\n\\] at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.normalizeCharClass(Unknown Source) at java.util.regex.Pattern.normalize(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.<init>(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source)
Pattern p = Pattern.compile("[\\r\\n\\\\]");
Nice one. I assumed the original problem was due to the 'Ô' but it seems to be be more general than that. If you haven't already done so, please post a bug report.