RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Match Default Document + Optional Querystring
Expression
^~/(?:default\.aspx)?(?:\?=.*)?$
Description
Designed for asp.net default document matching. It allows either a plain url (~/) or a default document url (~/default.aspx) both with an optional querystring. Cassini and IIS7 handle default document matching differently. The user could type it either way. The breadcrumb / sitemap system is funny about omitting default.aspx. Note: Doesn't handle #fragements
Matches
/default.aspx | /default.aspx?query=string | / | /?query=string
Non-Matches
/default.aspx#fragment | /default.aspx?query=string#fragment | /#fragment | /?query=string#fragment
Author Rating: Not yet rated. Matthew Harris
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: regexp is broken (when compared to its description)
Name: Erwin
Date: 1/30/2016 5:55:07 AM
Comment:
the name part of the optional querystring cannot match this invalidates some of the test cases and since .* is used, it will happily match "#", this some non-matches actually match


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials