Reputation: 51
Say I'm looking at a stream of a web page, and near the top it says About 367 results
etc etc. I would like to get the number (of results) following the word About
with a regex. Does anyone have an example? Or a bone-head tutorial for that matter? Thanks.
Upvotes: 1
Views: 115
Reputation: 2674
You can extract the number as follows
About (\d+)
or
About (\d+) results
In both cases the digits will be captured.
Upvotes: 1
Reputation: 88378
You'll want to capture the first group in for the regex /\bAbout\s+(\d+)/
Upvotes: 3