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

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 8 regular expressions found.

   Displaying page 1 of 1 pages; Items 1 to 8
Title Test Details Text Extension
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*))+\.(txt|TXT)$
Description
This RE validates a path/file of type txt (text file) This RE can be used as a filter on certain file types, while insuring the entire string is a fully qualified path and file. The filter value can be changed or added to as you need
Matches
c:\file.txt | c:\folder\sub folder\file.txt | \\network\folder\file.txt
Non-Matches
C: | C:\file.xls | folder.txt
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
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. To include more simply add logical 'or' (|) operator and append.
Matches
thisfile.mp3 | tH@tfile.wma
Non-Matches
whatever.exe | somethingelse.mpa | thisagain.wm3
Author Rating: Not yet rated. Pete Samwel
Title Test Details 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 | tH@tfile.wma
Non-Matches
whatever.exe | somethingelse.mpa | thisagain.wm3 | filenamemp3 | filename..mp3 | filename.wmap3
Author Rating: Not yet rated. Dusan Hlavaty
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
Title Test Details Last word
Expression
\w*$
Description
Finds the last word in a string eg. the user in \\domain\user or the extension/file type in a file name.
Matches
\\domain\user
Non-Matches
I want lots of $$
Author Rating: Not yet rated. Thomas Nielsen
Title Test Details Last word
Expression
\w*$
Description
Finds the last word in a string eg. the user in \\domain\user or the extension/file type in a file name.
Matches
\\domain\user
Non-Matches
I wan't lots of $$
Author Rating: Not yet rated. Thomas Nielsen
Title Test Details To validate the File Type for a FileUploader
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf)$
Description
You can use this to check the valid file type you have given to the last in the expression like ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf)$ This will accept .pdf only OR ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+((.pdf)|(.doc))$ This will accept .pdf and .doc OR ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+((.pdf)|(.doc)|(.txt))$ This will accept .pdf , .doc and .txt
Matches
C:\Documents and Settings\chandan.kumar\Desktop\1004.pdf
Non-Matches
C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg
Author Rating: The rating for this expression. Chandan Kumar
Title Test Details To allow certain file type while uploading a file using FileUpload
Expression
\.(?i:)(?:jpg|gif)$
Description
This expression will only allow the .jpg and .gif file to get uploaded. This handles the case of the file type i.e. it will accept .gif and .GIF both and so on .JPG and .jpg.
Matches
mypicture.jpg, MYPICTURE.JPG, MYPICTURE.GIF, mypicture.gif
Non-Matches
mypicture.png, mypicture.bmp
Author Rating: Not yet rated. Chandan Kumar
   Displaying page 1 of 1 pages; Items 1 to 8

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