Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 752695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:48:40+00:00 2026-05-14T14:48:40+00:00

Many URL rewriting utilities allow Regex matching. I need some URLs to be matched

  • 0

Many URL rewriting utilities allow Regex matching. I need some URLs to be matched against a couple of main querystring parmeter values no matter what order they appear in. For example let’s consider an URL having two key parameters ID= and Lang= in no specific order, and maybe some other non-key params are interspersed.

An Example URL to be matched with key params in any order:

  • http://www.example.com/SurveyController.aspx?ID=500&Lang=4 or
  • http://www.example.com/SurveyController.aspx?Lang=4&ID=500

Maybe with some interspersed non-key params:

  • http://www.example.com/SurveyController.aspx?Lang=3&ID=1&misc=3&misc=4 or
  • http://www.example.com/SurveyController.aspx?ID=1&misc=4&Lang=3 or
  • http://www.example.com/SurveyController.aspx?misc=4&Lang=3&ID=1 or
  • etc

Is there a good regex pattern to match against querystring param value in any order, or is it best to duplicate some rules, or in general should I look to other means?

Note: The main querystring values will also be captured using brackets i.e. ID=(3)&Lang=(500) and substituted into the destination URL, but that’s not the focus of the question.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:48:40+00:00Added an answer on May 14, 2026 at 2:48 pm

    I would suggest parsing the query string into a dictionary and working from there, but if you want regex, you can use alternation+repetition to match in any order (without inlining all possible sequences). Python example:

    >>> import re
    >>> p = re.compile(r'(?:[?&](?:abc=([^&]*)|xyz=([^&]*)|[^&]*))+$')
    >>> p.findall('x?abc=1&jjj=2&xyz=3')
    [('1', '3')]
    >>> p.findall('x?abc=1&xyz=3&jjj=2')
    [('1', '3')]
    >>> p.findall('x?xyz=3&abc=1&jjj=2')
    [('1', '3')]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's many regex's out there to match a URL. However, I'm trying to match
I am new to URL rewriting and saw in many sites the effect of
How can the Google short URL cater for so many URLs in web with
Hi all I have seen many articles on url rewriting but I didn't find
I'm writing some URL rewriting software, and I want to know which URL scheme
I'm trying to do some URL rewriting - but for some reason it's not
Many different representation of parameters in python such as : urllib2.urlopen(url[, data][, timeout]) urllib2.build_opener([handler,
i've seen in many forums that they cut the url from the center and
There are many similar questions, however they don't answer the problem of a url
I'm doing url rewriting (Wildcards) for a sigle web site based on this blog

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.