I realize HTML can not be parsed with regex. However, I have a string with some source code from a typical amazon web page.
<script type="text/javascript">
P.when("A", "jQuery").execute(function(A, $) {
var pageState = A.state('ftPageState');
if (typeof pageState === 'undefined') {
pageState = {};
}
if (pageState["fast-track-message"]) {
pageState["fast-track-message"].stopTimer();
}
<li> 48 pages</li>
pageState["fast-track-message"] = new fastTrackCountDown(20710,"fast-track-message");
A.state('ftPageState', pageState);
});
</script>
I want to grab the 48. Every number will be followed by pages</li>
How can I match this?
Attempt
var string_tester = String(datastuff.html());
var regex_tester = string_tester.match(/\d+ pages<\/li>/);