I want to use a regular expression to confirm if a URL that includes query parameters only includes a single ?. So far, I have a pattern of "^http.*?\?[^\?]+", which sort of works, but fails to apply to the entire match string. For example, with "http://somedomain.com?a=aaaaaaa&b=bbbbbbbbb", pattern will be found, matching entire string. However, pattern will also be found with "http://somedomain.com?a=aaaaaaa?b=bbbbbbbbb", matching up to and not including second "?". I tried including a end-of-string anchor ("^http.*?\?[^\?]+$"), but both variations still match. Any thoughts on how to do this?
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts. The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.