posix - Regex for detecting a query string -
i'm trying use regex testing url.
accepted cases:
www.mystite.com/whatever/?bla=dfgsd&page=test www.mystite.com/whatever/?bla=dfgsd&page=test& www.mystite.com/whatever/?bla=dfgsd&page=test&hello=bla www.mystite.com/whatever/?page=test&hello=bla
rejected:
www.mystite.com/whatever/?hello=bla&page=testfff www.mystite.com/whatever/?page=testfff&hello=bla - not
because misses &page=test&
, page=test&
or &page=test
that's tried, , doesn't work:
([^&]+)([page=test])([^&]+)
you can ignore domain , sub folder, i'm trying check after question mark
after reading question 3rd time think asking for:
&?page=test($|&)
this matches occurences of "page=test" optional "&" @ start. @ end there needs either "&" (optionally followed other characters) or nothing (end of string).
does solve problem?
Comments
Post a Comment