var ss= "<pre>aaaanbbbnccc</pre>ddd"; var arr= ss.match( /<pre.*?</pre>/gm ); alert(arr); // null
I'd want the PRE block be picked up, even though it spans over newline characters. I thought the 'm' flag does it. Does not.
So the solution is:
var ss= "<pre>aaaanbbbnccc</pre>ddd"; var arr= ss.match( /<pre[sS]*?</pre>/gm ); alert(arr); // <pre>...</pre> :)
Does anyone have a less cryptic way?
Edit: this is a duplicate but since it's harder to find than mine, I don't remove.
[^] as a "multiline dot". What I still don't understand is why