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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 2
Title Test Details valid file path pattern
Expression
^(([a-zA-Z]:)|((\\|/){1,2}\w+)\$?)((\\|/)(\w[\w ]*.*))+\.([a-zA-Z0-9]+)$
Description
Matches file paths to any valid format. Matches both "\" and "/" as valid separators in file path. Extension ("[a-zA-Z0-9]+") can be changed to any specific extension like (txt|jpg|png) and so on.Does NOT match relative file paths. Feel free to write any comments about bugs or anything, since this is my first contribution to regexlib
Matches
/asdjd/jhsdh.ajsd | E:\drive.txt | \\usr\home\docs.jpg | \users\assassin\home/yp.r15
Non-Matches
//home/boo/ | foo/bar.bmp
Author Rating: The rating for this expression. Abhishek Kale
   Displaying page 1 of 1 pages; Items 1 to 2

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