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 to use for verifying a path rather than my non-compliant, safer, overly simple one. More specifically an absolute path. |
Matches |
All RFC2396 compliant paths |
Non-Matches |
A non-RFC2396 compliant path |
Author |
Rating:
Not yet rated.
tedcambron
|
Source |
|
Your Rating |
|
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.