mercredi 12 août 2015

Regex matches as few characters as possible even without question mark

I'm using this expression:

(.*(?:<br\/>(?:<\/p>)?\n.*)+)

On this example text:

test text <br/>
test line2 <br/>
test line3 <br/>
test line4

Instead of giving me this as a complete match, it's splitted in two matches (when using g flag, otherwise it's only the first match):

MATCH ONE: 
test text <br/>
test line2 <br/>

MATCH TWO:
test line3 <br/>
test line4

(Link to example: http://ift.tt/1h3NsES)

Thanks for your help

Aucun commentaire:

Enregistrer un commentaire