开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜