I\'m trying to validate a query string with regex. Note that I\'m not trying to match out the values, but validate its syntax. I\'m doing this to practice regex, so I\'d app
I agree with Andy Lester, but a possible regex solution is
#^\?([\w-]+=[\w-]*(&[\w-]+=[\w-]*))?$#
which is very much like what you posted.
I haven't tested it and you didn't say what language you're using so it may need a little tweaking.