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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
([A-Z]:\\[^/:\*\?<>\|]+\.\w{2,6})|(\\{2}[^/:\*\?<>\|]+\.\w{2,6})
Description
This regular expression pattern can be used to check the validity of paths for file upload controls. The uploaded file can be either stored locally or accessible through UNC. It cannot contain illegal characters for the windows OS - that may be supported e.g. on Mac OS – and cannot be a URL (Yes, as weird as it may seem, some users enter URLs in the file upload box, even though there is a browse button...)
Matches
C:\temp\this allows spaces\web.config | \\Andromeda\share\file name.123
Non-Matches
tz:\temp\ fi*le?na:m<e>.doc | \\Andromeda\share\filename.a
Author Rating: Not yet rated. Alban Schmid
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: Javascript email validation Working Well Just try it
Name: hi
Date: 2/27/2012 12:06:18 AM
Comment:
function validateemail(sender, args) { var emailadd = document.getElementById("<%=txtEmailAddr.ClientID %>").value; var email = emailadd; var separation = email.split("@"); alert(separation); var firstvalue = separation[0]; var secondvalue = separation[1]; if (separation == null) { args.IsValid = false; return; } if (separation.length >= 3) { alert(separation.length); args.IsValid = false; return; } var firstSection = firstvalue.split(""); var len = firstSection.length; var previousValue = 65;//initalize for (var i = 0; i < len; i++) { var val = parseInt(firstSection[i].charCodeAt(0)); if (i == 0) { if ((val >=65 && val <=90) || (val >=97 && val <=122)) { args.IsValid = true; } else { args.IsValid = false; return; } } if (i == (len - 1)) { if (val == 45) { args.IsValid = false; return; } if (val == 46) { args.IsValid = false; return; } if (val == 95) { args.IsValid = false; return; } } if (previousValue == 95 && val == 45) { args.IsValid = false; return; } if (previousValue == 45 && val == 95) {


Title: Platform-dependent
Name: Adrian Malacoda
Date: 9/19/2010 5:11:02 PM
Comment:
This regex assumes the user is on Windows. I would highly recommend it NOT be used in a multiplatform/web environment.


Title: Improved version that does not enforce file extensions
Name: Anonymous
Date: 1/19/2010 7:05:14 AM
Comment:
^(([a-zA-Z]:\\)|(\\{2}))[^/:\*\?<>\|]+$


Title: Mr.
Name: Pedram Nimreezi
Date: 5/5/2003 1:38:21 AM
Comment:
c:\file.txt is a false negative.


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