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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
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: incorrect
Name: M.R.
Date: 11/4/2010 4:34:14 PM
Comment:
It validates zipTest.exe as well....


Title: pierpaolo
Name: vffv
Date: 9/4/2007 6:43:25 AM
Comment:
good


Title: Doesnt validate the . in front of the word zip
Name: Cammy
Date: 11/15/2006 3:54:35 AM
Comment:
Hi, this can pass through your regexp... both "test.zip" and "testzip" (without the '.' )


Title: Not working...
Name: Frank
Date: 8/25/2006 2:35:21 PM
Comment:
Hello, I'm trying to use this to validate an zip file upload, and it isn't working. Although, I can't say it is your regex, so I'm not going to down rate it. I'm trying to use it with ASP.NET's validators. Any suggestions or thoughts?


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