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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Detect zip files
Expression
^([a-zA-z]:((\\([-*\.*\w+\s+\d+]+)|(\w+)\\)+)(\w+.zip)|(\w+.ZIP))$
Description
I used this regex to check to make sure the file type being uploaded through an input tag was a zip file. Changing the '.zip' to another extension will change the file extension being verified.
Matches
C:\Downloads\AtlasPlayground.zip | C:\Documents and Settings\name\My Documents\Asdfasdfasdf.zip | Z:\Program Files\asdf\a.d.f.controlsQ1 23213\NET1\LiveExamplesCS.zip
Non-Matches
Z:\Downloads\A@#@tlasPlayground.zip | AtlasPlayground.zip
Author Rating: Not yet rated. alex
   Displaying page 1 of 1 pages; Items 1 to 1

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