If I have an HTML string such as:
<div><p>£20<span class="abc" /><span class="def">56</span></p></div>
And I want the text:
20<span class="abc" /><span class="def">56
How do I define a regular expression to match the target sections multiple times. So far I have:
str.match(/\d*<[^>]*>\d*/)
But this will only return the first number section 20<span class="abc" />
I need this to be flexible to match multiple tag / numeric sections while trimming anything leading or trailing the first / last digit in the string.
To match multiple times use to need use the global option
str.match(/your_expression_here/g)
^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With