I would like to know why the following happens:
Code: Select all
Pattern pt = Pattern.compile(" ( a ) \ \1#commentscomments",Pattern.COMMENTS);
The comment gets ignored, however the whitespace between the slashes are not.
I believe it because the compiler sees it as a wrong escape sequence.
However if I try to escape the slash as:
Code: Select all
Pattern pt = Pattern.compile(" ( a ) \\ \1#commentscomments",Pattern.COMMENTS);
Is there any way to avail of the Pattern.COMMENTS and the white spaces in the above mentioned context?
Thanks in advance.
The_Nick.