I'm trying, with no sucess, to get a number inside of the last occurence of a pattern inside of a HTML code. The pattern is data\\[\d{1,3}\\]
. How can i get the number 03
in the below example?
<body>
<h2>JavaScript Regular Expressions</h2>
<p>TEST</p>
<p>data[01]</p>
<button onclick="myFunction()">Try it</button>
<p>data[02]</p>
<p>TEST</p>
<p id="demo" test=data[03]></p>
</body>
I tried many combinations with $, but I could not make it work.