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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Regular Expression to validate file path and extension
Expression
^(?:[\w]\:|\\)(\\[a-z_\-\s0-9\.]+)+\.(txt|gif|pdf|doc|docx|xls|xlsx)$
Description
Regular Expression to validate file path and extension.Compatible with JavaScript and ASP.NET
Matches
\\192.168.0.1\folder\file.pdf | \\192.168.0.1\my folder\folder.2\file.gif | c:\my folder\abc abc.docx | c:\my-folder\another_folder\abc.v2.docx
Non-Matches
\\192.168.0.1\folder\fi/le.pdf | \\192.168.0.1\folder\\file.pdf | \\192.168.0.1\my folder\folder.2\.gif | c:\my folder\another_folder\.docx | c:\my folder\\another_folder\abc.docx | c:\my folder\another_folder\ab*c.v2.docx | c:\my?folder\another_folder\abc.v2.docx | file.xls
Author Rating: Not yet rated. Bryian Tan
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

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