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 8380917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:34:46+00:00 2026-06-09T16:34:46+00:00

I need a regular expression for the ASP.NET url rewriting module that will fulfill

  • 0

I need a regular expression for the ASP.NET url rewriting module that will fulfill the following test cases?

products/                  products.aspx?Atts=&Page=
products/att1/             products.aspx?Atts=att1/&Page=
products/att1/att2/        products.aspx?Atts=att1/att2/&Page=
products/2/                products.aspx?Atts=&Page=2
products/att1/2/           products.aspx?Atts=att1/&Page=2
products/att1/att2/2/      products.aspx?Atts=att1/att2/&Page=2

Can anyone help?

  • 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-06-09T16:34:47+00:00Added an answer on June 9, 2026 at 4:34 pm

    I managed to fudge this with two rules. Not as pretty as I might like but what can you do?

    <rule name="ProductsPagingRule" stopProcessing="false">
      <match url="^products([a-z0-9\-/]*)(?:/([0-9]+)/)"/>
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      </conditions>
      <action type="Rewrite" url="products{R:1}/?Page={R:2}" />
    </rule>
    
    <rule name="ProductsRule" stopProcessing="true">
      <match url="^products/([a-z0-9\-/]*)/" />
      <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      </conditions>
      <action type="Rewrite" url="products.aspx?PageId={R:1}" />
    </rule>
    

    Closest I came with a single rule was:

    ^products(?=(?:(?:[a-z0-9\-/]*)/([0-9]+)/$)?)(.[a-z0-9\-/]*)
    

    I’d still be interested in seeing this done in a single rule if anyone’s feeling brave…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We need help for regular expression that work with asp.net asp:RegularExpressionValidator to validate date
I need regex for Regular Expression Validator in ASP.NET, that user need to write
I need a regular expression that will not allow multiple special characters in a
I need a regular expression that will accept well-formed emails in several formats (see
I need a regular expression that would let me validate Url. I found this
I need an regular expression which matches the following: 'test foo bar, test' =>
I need a regular expression that will match the first letter of a song
I have been using the following regular expression in ASP.NET and Javascript: [a-zA-ZöäüÖÄÜß0-9]{1}[a-zA-ZöäüÖÄÜß0-9_.\-]{2,14}[a-zA-ZöäüÖÄÜß0-9.!]{1} Now,
I need to implement a regular expression in my asp.net mvc(C#) application using jquery.
I need a regular expression that I can use in VBScript and .NET that

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.