regex - Extract values with ampersands from query string -


i want extract baz value following query string:

foo=bar&baz=qux&norf&corge=grault 

the problem value of baz contains &. i've had success using lookhead this:

/baz=(.*)(?=[^=]*&)/ 

however, can't handle end of line or when there more 1 key-value after it.

is there regexp can handle this?

baz=([^=]*)(?=&|$) 

this should you.see demo.

https://regex101.com/r/oc5ry5/1


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -