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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find URL Segments
Expression
(?:[a-zA-Z0-9]+(?:(?:_|\-|\.)[a-zA-Z0-9]+)*)
Description
This is an expression I sometimes use to verify segments in a URL or directory path. It must begin and end with a word character and may contain "_" "-" and "." one at a time. It's non-capturing as it sits. More restrictive than RFC2396 and used to prevent directory transversal holes.
Matches
abc-123 | abc.def.ghi | my_path
Non-Matches
_abc | abc..123 | -my_path
Author Rating: Not yet rated. CharlesDemo
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

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