shanethehat
shanethehat

Reputation: 15570

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 expression to /<br[\s|\/]*><br[\s|\/]*>/gi, but is there a shorter way of taking the first expression and saying "this, but twice"?

Upvotes: 1

Views: 382

Answers (1)

HotN
HotN

Reputation: 4386

Try this one:

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

Upvotes: 2

Related Questions