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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find RFC Compliant Path
Expression
^(/(?:(?:(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\\-_.!~*'():\@&=+\$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))$
Description
After reading RFC2396 and researching it a little more I put together this regex rather than update my non-compliant, overly simple one. More specificaly an absolute path.
Matches
All RFC2396 compliant paths
Non-Matches
A non-RFC2396 compliant path
Author Rating: Not yet rated. Ted Cambron
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: Leaving It Alone
Name: Ted Cambron
Date: 2/8/2008 9:10:29 PM
Comment:
After exhausting research (and learning alot) I decided to leave this in it's purity a "the RFC compliant absolute path". I will update my overly simple website path instead.


Title: AAAHHH!!!!
Name: Ted Cambron
Date: 2/8/2008 10:00:49 AM
Comment:
Oh my gosh! A triple post! I refreshed twice and did not see the post and now this. Can someone fix this please?


Title: Issues
Name: Ted Cambron
Date: 2/8/2008 9:58:26 AM
Comment:
I just noticed, after some testing, that this "RFC compliant" abs_path regex allows for double dots (..) and that's unacceptable for my purposes and I'm sure many will agree with that without getting into details. I need to guarantee a secure path. This regex also allows for double forward slashes (//). That will throw an error in my case. I will look into this some more and make some updates that will go beyond RFC2396.


Title: Issues
Name: Ted Cambron
Date: 2/8/2008 9:58:10 AM
Comment:
I just noticed, after some testing, that this "RFC compliant" abs_path regex allows for double dots (..) and that's unacceptable for my purposes and I'm sure many will agree with that without getting into details. I need to guarantee a secure path. This regex also allows for double forward slashes (//). That will throw an error in my case. I will look into this some more and make some updates that will go beyond RFC2396.


Title: Issues
Name: Ted Cambron
Date: 2/8/2008 9:58:04 AM
Comment:
I just noticed, after some testing, that this "RFC compliant" abs_path regex allows for double dots (..) and that's unacceptable for my purposes and I'm sure many will agree with that without getting into details. I need to guarantee a secure path. This regex also allows for double forward slashes (//). That will throw an error in my case. I will look into this some more and make some updates that will go beyond RFC2396.


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