How to use regex?

I want to scrape between two strings

Agriculture Equip/Commodities</a> - 47 items

I want to get "47".

And for general, how can I be good at that regex thingy, any tutorial you can suggest ?

Good luck on that.. That's like asking for help learning astrophysics.

I've spent countless hours trying to hunt down Regex strings

try this:

([^-]+$ (Should extract everything after the last dash)
(?<=-)\d+ (looks for any digits following a dash) might not work because of the space

Hi try this one:

[^a> -]\w\d{1,4}\w[^items]

It'll pick out any number from 0 to 9999. If you need to match bigger numbers, change the 4 to the maximum number of digits, e.g. {1,6} would match up to 999999.

1 Like