开发者

AS3 regex - how to match 2 consecutive matches multiple times?

I have the following regex, which will match all the <br> and <br /> tags in a string:

/<br[\s|\/]*>/gi

I actually want to match every set of two consecutive tags, with valid matches being:

<br><br>
<br/><br>
<br><br/>
<br/><br/>
(and all variations with a space before the slash)

Obviously I can just double up the expressio开发者_JAVA百科n to /<br[\s|\/]*><br[\s|\/]*>/gi, but is there a shorter way of taking the first expression and saying "this, but twice"?


Try this one:

/(<br[\s|\/]*>){2}/gi

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜