JasperZelf JasperZelf - 1 year ago 84
Javascript Question

Regex to get a specific part of an URL

Say I've got an URL:


I'm looking for a regex that can extract all the characters of the filename up to the first underscore. So in the above URL I want to extract "yes".

So far I managed to get the whole "yes_no_no" bit using:

, but I can't seem to get it to only match "yes".

Answer Source

Try this:




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