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: 22 regular expressions found.

Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$
Description
Modified URL RegExp that requires (http, https, ftp)://, A nice domain, and a decent file/folder string. Allows : after domain name, and these characters in the file/folder sring (letter, numbers, - . _ ? , ' / \ + & % $ # = ~). Blocks all other special characters-good for protecting against user input!
Matches
http://www.blah.com/~joe | ftp://ftp.blah.co.uk:2828/blah%20blah.gif | https://blah.gov/blah-blah.as
Non-Matches
www.blah.com | http://www.blah"blah.com/I have spaces! | ftp://blah_underscore/[nope]
Author Rating: Not yet rated. Brandon Luhring
Title Test Details Label all parts of a URL
Expression
(?:(?<protocol>http(?:s?)|ftp)(?:\:\/\/)) (?:(?<usrpwd>\w+\:\w+)(?:\@))? (?<domain>[^/\r\n\:]+)? (?<port>\:\d+)? (?<path>(?:\/.*)*\/)? (?<filename>.*?\.(?<ext>\w{2,4}))? (?<qrystr>\??(?:\w+\=[^\#]+)(?:\&?\w+\=\w+)*)* (?<bkmrk>\#.*)?
Description
I needed a regular expression to break urls into labled parts. This is what I came up with. Got a few ideas from regexlib.com and from this msdn article. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/reconbackreferences.asp http://www.domain.com/folder does return a match but will not grab the folder name unless there is &quot;/&quot; at the end. http://www.domain.com/folder/
Matches
https://192.168.0.2:80/users/~fname.lname/file.ext | ftp://user1:pwd@www.domain.com | http://www.dom
Non-Matches
www.domain.com | user1:pwd@domain.com | 192.168.0.2/folder/file.ext
Author Rating: The rating for this expression. Ariel Merrell
Title Test Details Pattern Title
Expression
^((?:[a-zA-Z]:)|(?:\\{2}\w[-\w]*)\$?)\\(?!\.)((?:(?![\\/:*?<>"|])(?![.\x20](?:\\|$))[\x20-\x7E])+\\(?!\.))*((?:(?:(?![\\/:*?<>"|])(?![ .]$)[\x20-\x7E])+)\.((?:(?![\\/:*?<>"|])(?![ .]$)[\x20-\x7E]){2,15}))?$
Description
Matches drives, folders and file on a Windows OS. Folder matches must end with \ Folder and file names can not end with a space. I limited the file extension length to 15 though that not a restriction of a file's extension This is a mod of Darren's regex http://www.regexlib.com/REDetails.aspx?regexp_id=357 and my own http://www.regexlib.com/REDetails.aspx?regexp_id=137 Updated Feb 2005
Matches
C:\ | \\Server\share\path\File.txt | E:\My Files\Are\#1\
Non-Matches
C: | C:\\\ | C:\Trailing Space \
Author Rating: Not yet rated. Michael Ash
Title Test Details Pattern Title
Expression
^[^\\\/\?\*\&quot;\'\&gt;\&lt;\:\|]*$
Description
Validation of a Folder Name. Excludes all forbidden characters
Matches
321321321 dasds
Non-Matches
/\3fsdfsd
Author Rating: The rating for this expression. Nikolay Yordanov
Title Test Details Pattern Title
Expression
^((?&lt;DRIVE&gt;[a-z]:)|(\\\\(?&lt;SERVER&gt;[0-9]*[a-z\-][a-z0-9\-]*)\\(?&lt;VOLUME&gt;[^\.\x01-\x1F\\&quot;&quot;\*\?&lt;&gt;:|\\/][^\x01-\x1F\\&quot;&quot;\*\?|&gt;&lt;:\\/]*)))?(?&lt;FOLDERS&gt;(?&lt;FOLDER1&gt;(\.|(\.\.)|([^\.\x01-\x1F\\&quot;&quot;\*\?|&gt;&lt;:\\/][^\x01-\x1F\\&quot;&quot;\*\?&lt;&gt;:|\\/]*)))?(?&lt;FOLDERm&gt;[\\/](\.|(\.\.)|([^\.\x01-\x1F\\&quot;&quot;\*\?|&gt;&lt;:\\/][^\x01-\x1F\\&quot;&quot;\*\?&lt;&gt;:|\\/]*)))*)?[\\/]?$
Description
Verify &quot;well formed-ness&quot; of DOS or UNC paths. Passed over 170 NUnit test, (took 3 complete rewrites) Components of a path: DRIVE:=[a-z]: SERVER:=[0-9]*[a-z\-][a-z0-9\-]* FNAME:=[^\.\x01-\x1F\\&quot;&quot;\*\?&lt;&gt;:|\\/][^\x01-\x1F\\&quot;&quot;\*\?&lt;&gt;:|\\/]* VOLUME:=FNAME UNC:=\\SERVER\VOLUME ROOT:=(DRIVE|UNC) FOLDER:=.|..|FNAME FOLDERS:=FOLDER?([\]FOLDER)*[\]? PATH:=^ROOT?FOLDERS?$
Matches
his is a very 'long' folder\that is.part of 2 folders. | b\c\..\x. | \\Dads\Mp3\FileName1\.\TestDir2
Non-Matches
\\1.dads\C | \. folder\ | .ext
Author Rating: Not yet rated. Tristen Fielding
Title Test Details Pattern Title
Expression
^((([a-zA-Z]:)|(\\{2}\w+)|(\\{2}(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}))(\\(\w[\w ]*)))
Description
Regex to match valid folder paths. can be local, UNC with server name, or UNC with IP address
Matches
c:\ds\dsfsdf | \\192.168.14.118\23423 | \\fsdf\23423
Non-Matches
c:\ | \\192.168.12.114 | \\fff
Author Rating: The rating for this expression. John Conwell
Title Test Details Windows Folder Validation
Expression
^[^\\\/\?\*\"\>\<\:\|]*$
Description
Validates entry for a valid Windows folder name. Excludes all forbidden characters.
Matches
New Folder
Non-Matches
New ' Folder
Author Rating: Not yet rated. Ben Leishman
Title Test Details Full Windows Folder Path
Expression
^([A-Za-z]:|\\{2}([-\w]+|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\\(([^"*/:?|<>\\,;[\]+=.\x00-\x20]|\.[.\x20]*[^"*/:?|<>\\,;[\]+=.\x00-\x20])([^"*/:?|<>\\,;[\]+=\x00-\x1F]*[^"*/:?|<>\\,;[\]+=\x00-\x20])?))\\([^"*/:?|<>\\.\x00-\x20]([^"*/:?|<>\\\x00-\x1F]*[^"*/:?|<>\\.\x00-\x20])?\\)*$
Description
Validates the format of a Windows folder path ending with a backslash using the drive path or Universal Naming Convention (UNC)--without using lookaround.<br><br>Windows folder components: <br>(I) The drive can only be one letter. <br>(II) The server name (1) can only contain letters, numbers, and hyphens. However, Windows does allow underscores--which aren’t standard characters in the Request for Comments (RFC) 1035 standard--for networks using the Microsoft DNS Server. (Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;222823) or (2) can be an IP address <br>(III) The share name (also called the service name) (1) Can contain any character except ones with an ASCII code in the range of 0 (x00) through 31 (x1F) and the following: " * / : ? | < > \ , ; [ ] + = (Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;236388) (2) Can begin or end with a period, but cannot contain all periods (3) Cannot begin or end with a space (4) There must be at least one character that is not a space or period if the rest of the share name contains periods and spaces or just periods. <br>(IV) The folder and subfolder names (without the drive, share, or server name) (1) Can contain any character except ones with an ASCII code in the range of 0 (x00) through 31 (x1F) and the following: " * / : ? | < > \ (Reference: http://msdn2.microsoft.com/en-us/library/aa365247.aspx) (2) Cannot begin or end with a space or period.
Matches
d:\, \\Dpk\T c\, E:\reference\h101\, \\be\projects$\Wield\Rff\, \\70.60.44.88\T d\SPC2\
Non-Matches
j:ohn\, \\Dpk\, G:\GD, \\cae\.. ..\, \\70.60.44\T d\SPC2\
Author Rating: Not yet rated. John Marshall
Title Test Details Full Windows Folder UNC Path
Expression
^\\{2}[-\w]+\\(([^"*/:?|<>\\,;[\]+=.\x00-\x20]|\.[.\x20]*[^"*/:?|<>\\,;[\]+=.\x00-\x20])([^"*/:?|<>\\,;[\]+=\x00-\x1F]*[^"*/:?|<>\\,;[\]+=\x00-\x20])?)\\([^"*/:?|<>\\.\x00-\x20]([^"*/:?|<>\\\x00-\x1F]*[^"*/:?|<>\\.\x00-\x20])?\\)*$
Description
Validates the format of a Windows folder path ending with a backslash using the Universal Naming Convention (UNC)--without using lookaround.<br><br>Windows UNC folder components: <br>(I) The server name can only contain letters, numbers, and hyphens. However, Windows does allow underscores--which aren’t standard characters in the Request for Comments (RFC) 1035 standard--for networks using the Microsoft DNS Server. (Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;222823) <br>(II) The share name (also called the service name) (1) Can contain any character except ones with an ASCII code in the range of 0 (x00) through 31 (x1F) and the following: " * / : ? | < > \ , ; [ ] + = (Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;236388) (2) Can begin or end with a period, but cannot contain all periods (3) Cannot begin or end with a space (4) There must be at least one character that is not a space or period if the rest of the share name contains periods and spaces or just periods. <br>(III) The folder and subfolder names (without the share and server names) (1) Can contain any character except ones with an ASCII code in the range of 0 (x00) through 31 (x1F) and the following: " * / : ? | < > \ (Reference: http://msdn2.microsoft.com/en-us/library/aa365247.aspx) (2) Cannot begin or end with a space or period.
Matches
\\Dpk\T c\, \\be\projects$\Wield\Rff\
Non-Matches
j:ohn\, \\Dpk\, G:\GD, \\cae\.. ..\, d:\, E:\reference\h101\
Author Rating: Not yet rated. John Marshall
Title Test Details Full Windows Folder Drive Path
Expression
^[A-Za-z]:\\([^"*/:?|<>\\.\x00-\x20]([^"*/:?|<>\\\x00-\x1F]*[^"*/:?|<>\\.\x00-\x20])?\\)*$
Description
Validates the format of a Windows folder path ending with a backslash using the drive path--without using lookaround.<br><br>Windows folder drive path components: <br>(I) The drive can only be one letter. <br>(II) The folder and subfolder names (without the drive) (1) Can contain any character except ones with an ASCII code in the range of 0 (x00) through 31 (x1F) and the following: " * / : ? | < > \ (Reference: http://msdn2.microsoft.com/en-us/library/aa365247.aspx) (2) Cannot begin or end with a space or period.
Matches
d:\, E:\reference\h101\
Non-Matches
j:ohn\, \\Dpk\, G:\GD, \\cae\.. ..\, \\be\projects$\Wield\Rff\, \\Dpk\T c\
Author Rating: Not yet rated. John Marshall
Title Test Details Select File Accept Arabic and Englesh File name or Folder name
Expression
^[a-zA-Z]:\\(([\w]|[\u0621-\u064A\s])+\\)+([\w]|[\u0621-\u064A\s])+(.jpg|.JPG|.gif|.GIF|.BNG|.bng)$
Description
Select File Accept Arabic and Englesh File name or Folder name
Matches
C:\Documents and Settings\mohamedantar\ملف\My Pictures\صورة.gif
Non-Matches
:\Documents and Settings\mohamedantar\ملف\My Pictures\صورة.gif
Author Rating: Not yet rated. Mohamed Antar Ibrahem
Title Test Details Match unanchored urls in unstructured text
Expression
\b((?<!["'>])(?:https?://)?(?<![-@>])(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])\.)+(?:com|org|net|gov|mil|biz|info|name|aero|mobi|jobs|museum|[A-Z]{2})(?:/[-A-Z0-9\/_.]+)?(?:\?[-A-Z0-9&\._%=,]+)?(?!['"<]))\b
Description
Use this regex to match urls (including folder, file and querystring) in unstructured text that are not in anchor tags. Replace with <a href="$1">$1</a> to create anchor tags.
Matches
www.shschools.org/community/ethics_conference.html?s=keyword
Non-Matches
<a href="www.shschools.org/community/ethics_conference.html?s=keyword">www.shschools.org/community/ethics_conference.html?s=keyword</a>
Author Rating: Not yet rated. Bob Clark
Title Test Details Validate MS DOS 8.3 Directory or File name (without extension)
Expression
[^ _0-9a-zA-Z\$\%\'\-\@\{\}\~\!\#\(\)\&\^]
Description
Use this regular expression to find any invalid characters within a DOS 8.3 Directory or Folder name. Reference: http://support.microsoft.com/?id=120138
Matches
one$two folder_name file@name
Non-Matches
one:two folder*name file:name
Author Rating: The rating for this expression. Charles Forsyth
Title Test Details Folder Path Validation (local + netowork) for windows
Expression
^(((\\\\([^\\/:\*\?"\|<>\. ]+))|([a-zA-Z]:\\))(([^\\/:\*\?"\|<>\. ]*)([\\]*))*)$
Description
I'm very new to reg exp I've given a try ... for C# @"^(((\\\\([^\\/:\*\?""\|<>\. ]+))|([a-zA-Z]:\\))(([^\\/:\*\?""\|<>\. ]*)([\\]*))*)$" It worked for me ... Make neccessary changes as required
Matches
C:\abc\xyz, c:\, \\server10\mnop
Non-Matches
c:, \\server?abc , c:\abc|mno\abc\xyz
Author Rating: Not yet rated. P Mahender Reddy
Title Test Details Url without Querystring
Expression
((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\w\d:#@%/;$()~_\+-=\\\.&]*)
Description
Modified URL RegExp that requires (http, https, ftp,gopher,telnet,file|notes,ms-help)://, A nice domain, and a decent file/folder string.
Matches
http://regexlib.com/Add.aspx, http://www.regexlib.com/Add.aspx
Non-Matches
http://regexlib.com/Search.aspx?k=&c=2&m=-1&ps=20
Author Rating: Not yet rated. jibu georgy issac
Title Test Details Linux Path Verify
Expression
^/{1}(((/{1}\.{1})?[a-zA-Z0-9 ]+/?)+(\.{1}[a-zA-Z0-9]{2,4})?)$
Description
This expressions was written for C#. Matches all valid Linux absolute paths (files or folders). Will not work for relative paths that do not begin with a /, Also will only match files that have extensions consisting of 2, 3, or 4 characters. Currently fails with _ . or - in the path, this will be updated at some point.
Matches
/mnt/share/ | /home/.BASH | /mnt/share/pic.jpeg | /mnt/share/install.sh
Non-Matches
mnt/share | //mnt///share// | /mnt/share/install.installer | /home\user
Author Rating: The rating for this expression. Brandon Vasquez
Title Test Details Parse & Extract Filename Parts
Expression
^(.*?)([^/\\]*?)(\.[^/\\.]*)?$
Description
Simple (non-validating) match with numbered group captures that extracts parts of a filename into $1 = folder path, $2 = filename w/o extension, $3 = extension. Should work on Windows, OS X, and Unix/Linux, but not on OS 9 and OSs with folder separators other than slashes (either direction). Tested only on .NET RE engine.
Matches
test | test.txt | C:\test | C:\test.txt | C:\test.txt\testing.txt | C:\folder\test | C:\folder\test.txt.txt | C:\folder\test.txt.txt\testing.txt | /usr/test | /usr/test.txt | /usr/test.txt/testing.pdf
Non-Matches
N/A (some captures may end up being blank in the event of a relative path or no file extension)
Author Rating: The rating for this expression. Matthew
Title Test Details Folder filename extension
Expression
(.*[\\\/]|^)(.*?)(?:[\.]|$)([^\.\s]*$)
Description
This expression returns $1-folder (including trailing delimiter) $2-filename (without ext) $3-extension (excluding dot) Note: some captures may be blank, in the case the folder, filename or ext is missing Note2: tested on Perl regular expression engine
Matches
test -> [][test][] | test.txt -> [][test][txt] | C:\test -> [C:\][test][] | C:\test.txt -> [C:\][test][txt] | C:\test.txt\testing.txt -> [C:\test.txt\][testing][txt] | C:\folder\test -> [C:\folder\][test][] | C:\folder\test.txt.txt -> [C:\folder\][test.txt][txt] | C:\folder\test.txt.txt\testing.txt -> [C:\folder\test.txt.txt\][testing][txt] | /usr/test -> [/usr/][test][] | /usr/test.txt -> [/usr/][test][txt] | /usr/test.txt/testing.pdf -> [/usr/test.txt/][testing][pdf]
Non-Matches
N/A
Author Rating: Not yet rated. Petr Danihlik
Title Test Details Megaupload link
Expression
megaupload\.com.*(?:\?|&)(?:(?:folderi)?d|f)=([A-Z-a-z0-9]{8})
Description
Detects megaupload files and folders links.
Matches
http://www.megaupload.com/?d=QDNFF02H | http://www.megaupload.com/?f=TSNFLU2K | http://www.megaupload.com/xml/folderfiles.php?folderid=1DGR6C4H
Non-Matches
http://www.megaupload.com/?k=TSNFLU2K | http://www.megaupload.com/?f=TSNFLU#@ | http://www.megaupload.com/xml/folderfiles.php?folderod=1DGR6C4H
Author Rating: Not yet rated. Eduardo
Title Test Details url chunks
Expression
(http|ftp|https):\/\/(\w[\w\-_\.]*\.)?([_\-\w]+)(:[0-9]+)?([\/[\w_\.-]+]*)\/(\.?\w[\w._-]*[\w_-])?(#\w+)?([\w\-\.,@?^=%&amp;:\~\+#]*[\w\-\@?^=%&amp;\/\~\+#])?
Description
divides an url into the different parts: protocol, subdomain, tld, port, folder, file, anchor, parameter
Matches
http://www.example.com/folder/file.php#anchor?parameter=value
Non-Matches
www.example.com
Author Rating: The rating for this expression. sir-saimn
Change page:   |    Displaying page 1 of 2 pages; Items 1 to 20

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