Regex to Match URL with a Specific Query Param (Javascript) -


i need match set of urls , must contain specific query param

(type=vcl)

so far have /http:\/\/myhost:8080\/organization\/(\d*)\/mediaresource?.*$/

which matches urls formed http://myhost:8080/organizaton/5/mediaresource?anyparam(s) need matches if the url contains query param type=vcl

like: http://myhost:8080/organization/5/mediaresource?someparam=foo&type=vcl

can last part of regex urls contain query param care about?

you can use following regex:

http:\/\/myhost:8080\/organization\/(\d*)\/mediaresource\?\s*\btype=vcl\b\s* 

see demo

i added slash before ? matched literally, added \s* matching 0 or more non-whitespace symbols, , \btype=vcl\b urls have param matched.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

python - PIL cannot identify image file for io.BytesIO object -

java - disabling a node without disable its children in javafx -