Regex question - line breaks (or not)
here's my string:
</HEAD&g开发者_如何学JAVAt;
<BODY>
<html>
<head>
i need to detect the line-breaks so i used [\r\n]+
but the problem is, i need it to be optional - like the filter rule should also work if there are no line breaks at all (between rbody + html) .. how would i do that?
thx
Ivan and qid have it right.
[\r\n]*
will match any linebreak characters in any amount, including 0. Using +
meant 1 or more, thus the problem you ran into.
try using [\r\n]{0,}
/Klaus
精彩评论