- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
Validates a long filename using Windows' rules. Requires one valid filename character other than &quot;.&quot; for the first character and then any number of valid filename characters up to a total length of 255 characters. Unresolved is how to prevent the last character from being a &quot;.&quot; while still meeting all the features that this regex does now.
abcd.jpg | a b239.abcd ef12983 298 | a....23498
.abcde.jpg | abcde?.jpg | c:\abcde.jpg
Author Rating: Not yet rated. Dale Preston
Your Rating
Bad Good

Enter New 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: Unicode Support
Name: Dugald
Date: 5/15/2008 2:31:16 AM
It would seem abcÑdef is a valid Windows filename, but does not match the regular expression above. The middle character here is from ISO/IEC 8859-1 (00D1/209).

Title: Add extension
Name: Cloink
Date: 11/6/2006 9:37:01 AM
Just reduce the max size by a few and demand a suffix/extension: \.[a-z]{1,5} Who saves filenames that long?!

Title: Ignores valid names
Name: Thomas
Date: 5/25/2005 5:05:49 AM
Names starting with a period (e.g. .htaccess, .jpi_cache) are valid names under Windows. Although explorer won't let you rename a file to start with a period, other programs can save them as such, and you can manipulate the files without any problem.

Title: Allows invalid names
Name: Kris
Date: 3/14/2005 8:25:47 PM
Allows input that begins with leading or trailing spaces which are not valid windows filenames. Also allows the input to trail with period which is also invalid.

Copyright © 2001-2018, | ASP.NET Tutorials