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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find File Name
Expression
^([a-zA-Z]:\\)?[^\x00-\x1F"<>\|:\*\?/]+\.[a-zA-Z]{3,4}$
Description
This matches a valid windows filename. Not a valid path.I wanted something simple that covered all the bases
Matches
file.txt | fie.txt.pdf | file(with parenthesis).pdf
Non-Matches
*file.pdf | file.tx
Author Rating: The rating for this expression. Jose Paulino
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: This isn't even close
Name: KRowe
Date: 10/11/2015 11:54:48 AM
Comment:
Not only is file.tx valid but you are missing a ton of edge cases. See http://stackoverflow.com/a/62888/932549 for a more detailed discussion.


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