Displaying page
of
pages;
Items to
| Title |
Test
Details
Pattern Title
|
| Expression |
(AUX|PRN|NUL|COM\d|LPT\d)+\s*$ |
| Description |
"Be careful when opening or creating files by using Scripting File System Object. If the filename is based on the user's input, the user might attempt to open a serial port or printer." |
| Matches |
COM1 | AUX | LPT1 |
| Non-Matches |
image.jpg | index.html | readme.txt |
| Author |
Rating:
Not yet rated.
Chris Craft
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[0-9A-Za-z_ ]+(.[jJ][pP][gG]|.[gG][iI][fF])$ |
| Description |
Matches HTML image leaf filenames. |
| Matches |
good.gif | go d.GIf | goo_d.jPg |
| Non-Matches |
junk | bad.bad.gif | slash\gif. |
| Author |
Rating:
Not yet rated.
Geoffrey Swenson
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))? |
| Description |
Just a simple regExp to parse the stack trace. Developed when using the exception block from MS, coz they only showed the stack all bunched together. Could be used as follows:
[C#]
string regExParams = @"(at\s)(?<fullClassName>.+)(\.)(?<methodName>[^\.]*)(\()(?<parameters>[^\)]*)(\))((\sin\s)(?<fileName>.+)(:line )(?<lineNumber>[\d]*))?";
Regex re = new System.Text.RegularExpressions.Regex(regExParams,RegexOptions.Compiled);
MatchCollection mtc;
mtc = re.Matches(System.Environment.StackTrace);
foreach(Match mt in mtc)
{
MessageBox.Show(mt.Result("${fullClassName}"));
MessageBox.Show(mt.Result("${methodName}"));
MessageBox.Show(mt.Result("${parameters}"));
MessageBox.Show(mt.Result("${fileName}"));
MessageBox.Show(mt.Result("${lineNumber}"));
}
Seems to work well, but use at your own peril!!
Feel free to use and enhance (there's probably a lot that could be done, like getting parameters individually(?), etc) |
| Matches |
at System.IO.__Error.WinIOError(Int32 errorCode, String str) | at ExceptionManagementQuickStartSampl |
| Non-Matches |
ExceptionManagementQuickStartSamples.Form1.DoLogon(String userName, String password) in c:\program f |
| Author |
Rating:
Mike Stancombe
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^([a-zA-Z]\:)(\\[^\\/:*?<>"|]*(?<![ ]))*(\.[a-zA-Z]{2,6})$ |
| Description |
Matches filenames.
UPDATED on 1st Jan 2004. |
| Matches |
C:\di___r\fi_sysle.txt | c:\dir\filename.txt |
| Non-Matches |
c:\dir\file?name.txt |
| Author |
Rating:
Not yet rated.
Darren Neimke
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(mailto\:|(news|(ht|f)tp(s?))\://)(([^[:space:]]+)|([^[:space:]]+)( #([^#]+)#)?) |
| Description |
this is a very little regex for use within a content management software. links within textfields has not to be written in html. the editor of the cms is instructed to use it like this: 1. mention spaces in front and behind the url 2. start url with http://, mailto://, ftp:// ... 3. use optional linktext within #linktext# (separated with single space) 4. if there is no linktext the url/email will show up as linktext 5. avoid url with spaces in filename (use %20 urldecode) replace pattern (space in front): <a href="\\1\\3\\4" target="_blank">\\3\\6</a> |
| Matches |
http://www.domain.com | http://www.domain.com/index%20page.htm #linktext# | mailto://user@domai |
| Non-Matches |
<a href="http://www.domain.com">real html link</a> | http://www.without_space_ |
| Author |
Rating:
Not yet rated.
Martin Schwedes
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[\w0-9äÄöÖüÜß\-_]+\.[a-zA-Z0-9]{2,6}$ |
| Description |
This RegEx can be used to varify (esp. when receiving data from forms) filenames. No Path is allowed. German Special Characters are allowed. |
| Matches |
gut.txt |
| Non-Matches |
&quatsch | qua%tsch.txt | auch_quatsch.test.txt |
| Author |
Rating:
Not yet rated.
D dW
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^[^\\\./:\*\?\"<>\|]{1}[^\\/:\*\?\"<>\|]{0,254}$ |
| Description |
Validates a long filename using Windows' rules. Requires one valid filename character other than "." for the first character and then any number of valid filename characters up to a total length of 255 characters. Unresolved is how to prevent the last character from being a "." while still meeting all the features that this regex does now. |
| Matches |
abcd.jpg | a b239.abcd ef12983 298 | a....23498 |
| Non-Matches |
.abcde.jpg | abcde?.jpg | c:\abcde.jpg |
| Author |
Rating:
Not yet rated.
Dale Preston
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\A([A-Za-z0-9'~`!@#$%&^_+=\(\){},\-\[\]\;])+?([ A-Za-z0-9'~`
!@#$%&^_+=\(\){},\-\[\];]|([.]))*?(?(3)(([ A-Za-z0-9'~`!@#$
%&^_+=\(\){},\-\[\]\;]*?)([A-Za-z0-9'~`!@#$%&^_+=\(\){},\-\[
\];])+\z)|(\z)) |
| Description |
Used to match windows filenames. Fails if there is leading or trailing spaces. Fails if the input contains /\:*?"<>| . Fails if the input begins or ends with '.' |
| Matches |
Test.txt | T est.txt | Rosco's.Test.txt |
| Non-Matches |
\Folder\Test.txt | T*est.txt | Test. |
| Author |
Rating:
Rosco Pikotrain
|
| Title |
Test
Details
URL
|
| Expression |
^((([hH][tT][tT][pP][sS]?|[fF][tT][pP])\:\/\/)?([\w\.\-]+(\:[\w\.\&%\$\-]+)*@)?((([^\s\(\)\<\>\\\"\.\[\]\,@;:]+)(\.[^\s\(\)\<\>\\\"\.\[\]\,@;:]+)*(\.[a-zA-Z]{2,4}))|((([01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}([01]?\d{1,2}|2[0-4]\d|25[0-5])))(\b\:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)\b)?((\/[^\/][\w\.\,\?\'\\\/\+&%\$#\=~_\-@]*)*[^\.\,\?\"\'\(\)\[\]!;<>{}\s\x7F-\xFF])?)$ |
| Description |
Matches a URL string by: protocol,subdomain,domain,ip address,port number,path and/or filename |
| Matches |
http://regexlib.com | https://regexlib.com:80 | 66.129.120.94/Search.aspx |
| Non-Matches |
http:/regexlib.com | https://regexlib.com:65536 | 66.129.120.256/Search.aspx. |
| Author |
Rating:
Not yet rated.
Dean Dal Bozzo
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?<=(?:\\))[a-zA-Z0-9\-\s_]*(?=(?:\.\w*$)) |
| Description |
WINDOWS ONLY
Useful to get the filename whenever you get it from anysource, recommended for non-critical filename-dependant applications. |
| Matches |
c:\program files\anyfolder\file.xls | c:\program files\any.folder\file with weird name_.xls |
| Non-Matches |
c:\program files\anyfolder\file*.xls | c:\program files\anyfolder\file?.xls | c:\program files\anyfo |
| Author |
Rating:
Not yet rated.
Jose Paez
|
| 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 |
|
| Non-Matches |
whatever.exe | somethingelse.mpa | thisagain.wm3 | filenamemp3 | filename..mp3 | filename.wmap3 |
| Author |
Rating:
Not yet rated.
Dusan Hlavaty
|
| Title |
Test
Details
Path & Filename in realtive path
|
| Expression |
^(((\.\.){1}/)*|(/){1})?(([a-zA-Z0-9]*)/)*([a-zA-Z0-9]*)+([.jpg]|[.gif])+$ |
| Description |
Nice for checking local filesystem relative pathing. I used it for testing in php scripts that work with images. |
| Matches |
../../pictures/products/image.gif; ../image.jpg; image.gif |
| Non-Matches |
http://www.domain.de/image.gif; ../../badscript.php; |
| Author |
Rating:
Marcus
|
| Title |
Test
Details
path/filename
|
| Expression |
^[/]*([^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}/)*[^/\\ \:\*\?"\<\>\|\.][^/\\\:\*\?\"\<\>\|]{0,63}$ |
| Description |
a simplistic path/filename for windows (more restrictive than for Mac OS or *nix). Updated escaping, end of string. |
| Matches |
path/to/filename.txt | /prefixed.slash/value | /a/single/l/e/t/t/e/r |
| Non-Matches |
lead/space | .hidden/folder | wildcards.??? |
| Author |
Rating:
Amgine
|
| Title |
Test
Details
Simple Windows filename finder
|
| Expression |
([0-9a-z_-]+[\.][0-9a-z_-]{1,3})$ |
| Description |
Will match a Windows filename containing alphanumerics, hyphens (-) and underscores (_). There is no length limit on the first part of the filename, but the extension must be between 1 and 3 characters. |
| Matches |
open_01.pdf, 00153._-, _abc_.--1 |
| Non-Matches |
readme.e$e, save6^.doc, open_01., .txt, leisure.docx |
| Author |
Rating:
Not yet rated.
Nick
|
| Title |
Test
Details
Windows filename
|
| Expression |
(?i)^(((\\\\(\?\\(UNC\\)?)?)([A-Z]:\\|([^\\\/\:\*\?\"\<\>\|\.\s][^\\\/\:\*\?\"\<\>\|]+[^\\\/\:\*\?\"\<\>\|\.\s]\\){2}))|[A-Z]:\\)([^\\\/\:\*\?\"\<\>\|\s][^\\\/\:\*\?\"\<\>\|]+[^\\\/\:\*\?\"\<\>\|\s]\\)*([^\\\/\:\*\?\"\<\>\|\.\s][^\\\/\:\*\?\"\<\>\|\.]+[^\\\/\:\*\?\"\<\>\|\.\s])(\.[^\\\/\:\*\?\"\<\>\|\.\s]+)*?$ |
| Description |
Matches valid Windows filenames using local, network and UNC formats. |
| Matches |
C:\Program Files\RegEx\RegEx.exe.manifest |
| Non-Matches |
C:\Filename.* |
| Author |
Rating:
Not yet rated.
Frank Pottle
|
| Title |
Test
Details
Rapidshare.com Urls
|
| Expression |
/rapidshare\.com\/files\/(\d+)\/([^\'^\"^\s^>^<^\\^\/]+)/ |
| Description |
matches all rapidshare.com links /files / 8 numbers / filename |
| Matches |
http://rapidshare.com/files/61674290/somefile.rar | http://rapidshare.com/files/61674290/somefile2.rar | http://rapidshare.com/files/61674290/Shrek.The.Third_GG_SG_.part1.rar |
| Non-Matches |
-- |
| Author |
Rating:
Not yet rated.
Robert Pitt
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(?:(?<scheme>[a-z]+):\/\/)?(?:(?<usern>[a-z0-9_.]*)(?::(?<passw>[a-z0-9_.]*))?@)?(?<domain>(?:(?:[a-z][a-z0-9_-]+\.?)+|[0-9]{1,3}(?:\.[0-9]{1,3}){3}))(?::(?<port>[0-9]+))?(?<path>(?:\/[.%a-z0-9_]*)+)?(?:\?(?<query>(?:&?[][a-z0-9_]+(?:\=?[a-z0-9_;]*)?)+))?(?:#(?<fragment>[a-z0-9_]+))?$ |
| Description |
Matches URI's!
"filename.ext" is part of path. ER can't differ file name from directory name.
only domain is required.
scheme://usern:passw@domain:port/path/file.ext?querystring#fragment |
| Matches |
domain | ftp://localhost:21/ | 192.168.254.0 | http://username: [email protected]:1234/path1/pathX/filename.ext?query=string&example=v1#fragment |
| Non-Matches |
non-alpha://domain | domain:non-number |
| Author |
Rating:
Wesley Menezes
|
| Title |
Test
Details
Windows Drive Letter & UNC Path
|
| Expression |
^((\\\\[a-zA-Z0-9-]+\\[a-zA-Z0-9`~!@#$%^&(){}'._-]+([ ]+[a-zA-Z0-9`~!@#$%^&(){}'._-]+)*)|([a-zA-Z]:))(\\[^ \\/:*?""<>|]+([ ]+[^ \\/:*?""<>|]+)*)*\\?$ |
| Description |
This expression was written for C#, and as such you should just be able to drop it in.
It matches Windows paths, be they the drive letter version or the UNC version. It was not written to specifically match filenames, but it will in most cases anyway.
Be aware that Windows has a maximum path+filename length (260 chars on XP) and this regular expression does not check for this.
This has been tested against large datasets. |
| Matches |
C:\Program Files\Test, \\server\share\directory |
| Non-Matches |
c:?Program Files\Lab, \\$erver\sh*re\directory, a:\di:::r |
| Author |
Rating:
Tristan DF Wilson
|
| Title |
Test
Details
Windows Filename
|
| Expression |
^[^ \\/:*?""<>|]+([ ]+[^ \\/:*?""<>|]+)*$ |
| Description |
This was written for C# and so you should just be able to drop it into your C# program.
Although you can create files with leading and trailing spaces through non-GUI means, the Windows GUI itself eats those spaces if you try to rename the file. For this reason I made the decision to consider file names with leading and trailing spaces invalid.
This has been tested against large data sets. |
| Matches |
bla, file.txt, !@#$ |
| Non-Matches |
bla , file:txt, /\*? |
| Author |
Rating:
Not yet rated.
Tristan DF Wilson
|
| Title |
Test
Details
Validate extension of files such as asp,aspx,xls,doc Extensions etc
|
| Expression |
([a-zA-Z1-9]*)\.(((a|A)(s|S)(p|P)(x|X))|((h|H)(T|t)(m|M)(l|L))|((h|H)(t|T)(M|m))|((a|A)(s|S)(p|P))|((t|T)(x|X)(T|x))|((m|M)(S|s)(P|p)(x|X))|((g|G)(i|I)(F|f))|((d|D)(o|O)(c|C))) |
| Description |
Validate Filename,PageName,ImageName etc
such as
filename.doc
filename.xls
pagename.aspx
pagename.asp
pagename.htm
pagename.html
Extensions
etc ... |
| Matches |
filename.doc,pagename.aspx etc |
| Non-Matches |
page.jpg |
| Author |
Rating:
Not yet rated.
Pranav
|
Displaying page
of
pages;
Items to