- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Query String Regex
This is a very simple regex that check the query part of a string. That is to say anything after the "?" at the end of an URL.
?key=value | ?key1=value1&key2=value2
key=value | ?key=value&
Author Rating: The rating for this expression. tedcambron
Your Rating
Bad Good

Enter New 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: Yes, You're Right
Name: Ted Cambron
Date: 2/20/2011 8:14:21 PM
You are absolutely right. I said after the "?" and it is not part of the query string. I added it to the expression to be used to check query strings if there is one and needed the "?" in this regex for that purpose. This is technically not part of the query string but the for purposes of checking for one it has to be there.

Title: Bad documentation
Name: Lionel
Date: 10/6/2008 8:07:49 AM
It is said "that is to say anything after the ?". Yes this is the definition of the query string. But : "matches ?key=value", "non matches key=value" Well the ? is not part of a query string. You said it before... everything _after_ the ? So key=value is a correct query string Have a look at the HTTP POST method. The posted data does not start with a ?

Copyright © 2001-2024, | ASP.NET Tutorials