javascript - Matching only one group -
i have following text:
<p>k</p><p><span class="placeholder" code="{yszz}">samsung xyz</span> </p> <p>khgj <span class="placeholder" code="{uidju}">iphone 9k</span> </p></div>
i want replace span tags respective code attribute. i'm using pattern:
/<span class="placeholder" code="(.*?)">(?:.*)<\/span>/gi
but it's matching first span last, instead of each span individually. missing?
https://regex101.com/r/fp4ad7/1
thank you
you misses ?
. .*
greedy default, need make non-greedy adding ?
next .*
.
<span class="placeholder" code="(.*?)">.*?<\/span> ^ |
Comments
Post a Comment