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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
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: error
Name: manshi
Date: 5/24/2016 9:06:00 AM
Comment:
not running in java error illigal escape sequence


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