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

  • Home
  • SEARCH
  • 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 3395374
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:16:57+00:00 2026-05-18T04:16:57+00:00

Here is a typical URL I’m trying to rewrite: Example requested URL: http://topleveldomain/search?q=clause1+clause2+clause3&State=FL It

  • 0

Here is a typical URL I’m trying to rewrite:

Example requested URL:
http://topleveldomain/search?q=clause1+clause2+clause3&State=FL

It should rewrite to:
http://topleveldomain/index.cfm?q=clause1+clause2+clause3&State=FL

It sure does look simple enough, but the plus signs (and various query lengths) are giving me fits. I have written a few different Regex expressions that actually test out as having matched according to the URL Rewrite Module in IIS7, but when I apply the rule it doesn’t work. I’m certain the problem is in my Regex and not the expression of the replacement text (the rewritten URL with backreferences). The reason I know that is that I’ve tested a rewrite to a static URL with no backreference to the regex and it still does not work, even though it tests as a match according to the URL Rewrite admin app.

The number of clauses (and plus signs) could be as few as one up to infinity (or breakage, whichever comes first, haha).

Here is the most recent regex I wrote to match that URL. It’s the fourth or fifth regex I’ve written, all of which are showing matches in the URL Rewriter, but not matching in real practice.

search\?q=(\S+)&State=([a-z][a-z])$

It’s my desire to capture two backreferences:

  1. The query string, or “q” which is what the user typed in the search box
  2. The state value, which is what the user selected via an HTML SELECT form input

The method of data entry also seems not to matter, as I’ve tried both POST-ing and GET-ting the string data from the application and also by entering the URL into the browser.

Before you say something about the statecode regex, I realize my regex to match the two-letter state code is loose enough to allow invalid USA state codes — that’s not important because the URLs will be published from app/database values.

UPDATE: the failure of the regex pattern to match the input string from the browser is due to the question mark character in the URL being interpreted, whether it comes from the application (written as form submitting a GET) or if it’s just typed or pasted into the browser’s address bar.

Chalk it up to user error.

The regex after the question mark needs to be entered in the URL Rewrite [additional] Conditions box as a {Query_String} where it also accepts regex patterns.

IMO given the way that IIS/URL Rewrite parse the HTTP request, the test of a URL string which contains a question mark ought to throw an error or match with a disclaimer or warning.

  • 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-18T04:16:57+00:00Added an answer on May 18, 2026 at 4:16 am

    What about:

    ^search\?q=([a-zA-Z0-9_+-]+)&State=([a-zA-Z]{2})$ index.cfm?q=$1&State=$2
    

    That is, regex pattern:

    search\?q=([a-zA-Z0-9_+-]+)&State=([a-zA-Z]{2})
    

    Replacement:

    index.cfm?q=$1&State=$2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the scenario. I'm using a url rewriter that allows me to specify patterns
$.ajax({ type: POST, url: some.php, data: name=John&location=Boston, success: function(msg){ alert( Data Saved: + msg
** Question edited ** Here's a typical Makefile template : TARGET = my_prog #
Here is what I am trying to achieve in PHP: I have this string:
Here's what I'm trying to do... It's quite simple and obviously there must be
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote

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.