Need regex for IIS URL rewrite

Posted on 2011-10-11
Last Modified: 2012-08-13
I have to write a URL re-write using the IIS7 url rewrite tool.

My original URL looks like /events/A-New-Site-OOO.htm?promotion=3036
I need the to be able to create the back references for each part...

$1 = events
$2 = A-New-Site-OOO
$3 = promotion=3036

$2 should be able to handle hyphens
$3 should be everything after the ? or the original query string
Question by:mackaboogie
    LVL 4

    Author Comment

    Just a starter...
    I started with something like this:

    What it gives me is the following..

    $1 = events
    $2 = A-New-Site-OOO
    $3 = .htm?promotion=3036

    so I am pretty close...
    LVL 34

    Expert Comment

    by:Terry Woods
    LVL 63

    Accepted Solution

    Here you go:

    Open in new window

    LVL 74

    Expert Comment

    by:käµfm³d 👽
    What if you did:


    Open in new window


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
    Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now