solution: this works:
String p="<pre>[\\\\w\\\\W]*</pre>";
I want to match and capture the enclosing content of the <pre></pre> tag tried the following, not working, what's wrong?
String p="<pre>.*</pre>";
Matcher m=Pattern.compile(p,Pattern.MULTILINE|Pattern.CASE_INSENSITIVE).matcher(input);
if(m.find()){
String g=m.group(0);
System.out.println("g is "+g);
}
[\\\\w\\\\W]will match a backslash,worW. You probably meant[\\w\\W], but you don't need to do that. Just use the DOTALL flag, as I said in my answer. That other trick is used a lot in JavaScript because JS has no equivalent for the DOTALL flag.