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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Check filename extensions
Expression
^.*(([^\.][\.][wW][mM][aA])|([^\.][\.][mM][pP][3]))$
Description
Matches a file name to be either a .wma or .mp3 file. This can be used to check file uploads to make sure they are of a certain type. Substitute letters where appropriate for specific file types. This is a better solution (I think) than #343. Works in Javascript and C#.
Matches
thisfile.mp3 | [email protected]
Non-Matches
whatever.exe | somethingelse.mpa | thisagain.wm3 | filenamemp3 | filename..mp3 | filename.wmap3
Author Rating: Not yet rated. Dusan Hlavaty
Source my own expression
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: It not quite correct
Name: M.R.
Date: 11/4/2010 4:23:10 PM
Comment:
It validates also files like mp3test.exe This is a serious problem when uploading files on a server... Regards, M. R.


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