Joe Z Joe Z - 1 year ago 110
HTML Question

Regex Select numeric string between elements

I have been searching stack and Google and have figured out some of what I'm trying to do. Here is the string


I need to get the numerics between

So it should return

Here's what I have so far:

This does work but is returning the

Is there a way to to return only

This regex is also returning some other elements which I don't need in the HTML in some instances.

Answer Source

It's going to depend on which regex engine you use. & may have special meaning. I think the simplest approach here is something like /w=(\d+)/ or /w=([0-9]+)/ assuming no negatives or decimals in your numbers

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download