I'm looking for the most efficient way of finding and returning a specific text out of a big massive string in JS.
The rule of the specific text is a text that starts with
"ID_"
and ends with".pdf"
.
Assuming I'm having such a string (short tiny version of it):
<ul>
<li><a href="/questions/237104/ID_2556.pdf">Click here to
download.</a></li>
<li><a href="/questions/237104/ID_37.pdf">Click
here to download.</a></li>
<li><a
href="/questions/237104/ID_29997.pdf">Click here to download.</a></li>
<li><a href="/questions/237104/ID_0554.pdf">Click here to
download.</a></li>
</ul>
The script should return these separate values as strings:
ID_2556.pdf
ID_37.pdf
ID_29997.pdf
ID_0554.pdf