74 regular expressions found in this category!
Displaying page
of
pages;
Items to
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\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\s]$ |
Description |
This Regex (can be used e.g. in PHP with eregi) will match any valid URL. Unlike the other exapmles here, it will NOT match a valid URL ending with a dot or bracket. This is important if you use this regex to find and "activate" Links in an Text |
Matches |
https://www.restrictd.com/~myhome/ |
Non-Matches |
http://www.krumedia.com. | (http://www.krumedia.com) | http://www.krumedia.com, |
Author |
Rating:
Not yet rated.
Michael Krutwig
|
Title |
Test
Details
Pattern Title
|
Expression |
([A-Z]:\\[^/:\*\?<>\|]+\.\w{2,6})|(\\{2}[^/:\*\?<>\|]+\.\w{2,6}) |
Description |
This regular expression pattern can be used to check the validity of paths for file upload controls. The uploaded file can be either stored locally or accessible through UNC. It cannot contain illegal characters for the windows OS - that may be supported e.g. on Mac OS – and cannot be a URL (Yes, as weird as it may seem, some users enter URLs in the file upload box, even though there is a browse button...) |
Matches |
C:\temp\this allows spaces\web.config | \\Andromeda\share\file name.123 |
Non-Matches |
tz:\temp\ fi*le?na:m<e>.doc | \\Andromeda\share\filename.a |
Author |
Rating:
Not yet rated.
Alban Schmid
|
Title |
Test
Details
UK Domain Names
|
Expression |
^(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk$ |
Description |
UK domain names. Includes the following restrictions from Nominet as at time of posting:
1.Only a-z, 0-9 and hyphen may be used.
2.First or last character may not be a hyphen.
3.Third and fourth characters may not both be hyphens.
4.Third level domain may not be a single character.
5.Third level domain may not be two letters or two numbers.
6.Third level domain may be one letter and one number.
This does not yet include the following restrictions:
1.Whole domain may not be longer than 64 characters in length.
2.Third level domain may not duplicate any top/second level domain. |
Matches |
zeropanic.co.uk | z2.co.uk | 1-1.org.uk |
Non-Matches |
zeropanic.com | z.co.uk | zz.co.uk |
Author |
Rating:
Not yet rated.
Amos Hurd
|
Title |
Test
Details
Pattern Title
|
Expression |
(^[a-zA-Z0-9]+://) |
Description |
Use in a .net Regex.Split() to pull the protocol out of a url into the first array entry. |
Matches |
myprot://server/path.asp |
Non-Matches |
server/path.asp |
Author |
Rating:
Not yet rated.
blake wolf
|
Title |
Test
Details
Pattern Title
|
Expression |
^http://([a-zA-Z0-9_\-]+)([\.][a-zA-Z0-9_\-]+)+([/][a-zA-Z0-9\~\(\)_\-]*)+([\.][a-zA-Z0-9\(\)_\-]+)*$ |
Description |
A very crude url pattern. |
Matches |
http://www.jonas.no/~webs(i)der/jon_as.php | http://www.yahoo.com/net//ore |
Non-Matches |
http://www./no/good | imap://www.com/ |
Author |
Rating:
Not yet rated.
Martin Matusiak
|
Title |
Test
Details
UK Domain Names with Protocol and Port
|
Expression |
^(ht|f)tp((?<=http)s)?://((?<=http://)www|(?<=https://)www|(?<=ftp://)ftp)\.(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk(:\d+)?\/?$ |
Description |
UK http/https/ftp URI. Based on my previous expression, this one takes an optional port number and optional trailing slash. |
Matches |
http://www.zeropanic.co.uk/ | http://www.zeropanic.co.uk:81/ | http://www.zeropanic.co.uk:81 |
Non-Matches |
http://www.zeropanic.com:81/ |
Author |
Rating:
Not yet rated.
Amos Hurd
|
Title |
Test
Details
Pattern Title
|
Expression |
[a-zA-Z]{3,}://[a-zA-Z0-9\.]+/*[a-zA-Z0-9/\\%_.]*\?*[a-zA-Z0-9/\\%_.=&]* |
Description |
A simple url search pattern that works against the most generic cases. A little better in terms of matches than the other URL expressions listed. |
Matches |
http://someserver | http://www.someserver.com/ | http://www.someserver.com/somefile.txt |
Non-Matches |
Thin | Lizzy |
Author |
Rating:
Not yet rated.
Gerrard Lindsay
|
Title |
Test
Details
UK Domain Names with Protocol
|
Expression |
^(ht|f)tp((?<=http)s)?://((?<=http://)www|(?<=https://)www|(?<=ftp://)ftp)\.(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk$ |
Description |
UK domains with protocol for http/https/ftp. Based on my previous expression, this allows the subdomain "www" for the http/https protocols, or "ftp" for the ftp protocol only. |
Matches |
http://www.zeropanic.co.uk | ftp://ftp.sunsite.ac.uk | https://www.z2.co.uk |
Non-Matches |
gopher://www.z2.co.uk | http://ftp.z2.co.uk | ftp://www.z2.co.uk |
Author |
Rating:
Not yet rated.
Amos Hurd
|
Title |
Test
Details
Pattern Title
|
Expression |
wsrp_rewrite\?(?<wsrp_uri>[\w%:&\\/;.]*)/wsrp_rewrite |
Description |
Matches a string used to rewrite urls under the WSRP specification. It captures the URL-Encoded string that represents a url. Url validation is not provided. |
Matches |
wsrp_rewrite?http%3a%2f%2fregexplib.com%3fid%3d1%26message%3dtest/wsrp_rewrite | wsrp_rewrite?http:/ |
Non-Matches |
http%3a%2f%2fregexplib.com%3fid%3d1%26message%3dtest | http://www.regexplib.com/Add.aspx |
Author |
Rating:
Not yet rated.
Andres Garcia
|
Title |
Test
Details
Pattern Title
|
Expression |
.*?$(?<!\.aspx) |
Description |
Matches a string to ensure that it does not end with .aspx; sure, you'd probably use string handling to do something this simple but, in the real world you'd whack a regex which validates a valid url to the front of this.
The pattern was created by Wayne King; you can read about it here:
http://scottwater.com/blog/posts/10204.aspx |
Matches |
http://weblogs.asp.net/DNeimke/blah.gif |
Non-Matches |
http://weblogs.asp.net/DNeimke/Default.aspx |
Author |
Rating:
Not yet rated.
Darren Neimke
|
Title |
Test
Details
Pattern Title
|
Expression |
\.com/(\d+)$ |
Description |
This is a regex I wrote to capture requests to AspAlliance.com with an article id as the only thing after the domain. So http://aspalliance.com/123 would go to article number 123. It maps the URL to the actual aspx file that displays the article based on the ID. |
Matches |
http://aspalliance.com/123 | www.aspalliance.com/123 | http://aspalliance.com/34 |
Non-Matches |
http://aspalliance.com/article.aspx?id=123 | http://aspalliance.com/ | http://aspalliance.com/articl |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$ |
Description |
Domain names:
This regular expression tests the validity of a domain or hostname. It will match any valid domain name that does not contain characters which are invalid in URLs, and which ends in .com, .org, .net, .mil, or .edu. You can add additional valid TLDs by appending the | (pipe) character and the desired TLD to the list in the parens. |
Matches |
3SquareBand.com | asp.net | army.mil |
Non-Matches |
$SquareBand.com | asp/dot.net | army.military |
Author |
Rating:
Not yet rated.
G. Andrew Duthie
|
Title |
Test
Details
Pattern Title
|
Expression |
^DOMAIN\\\w+$ |
Description |
In response to a question on the regex list at www.aspadvice.com, this expression should ensure that a login field's username includes a 'DOMAIN\' prefix. The latter part of the expression should probably be limited so that it only allows usernames of appropriate lengths, perhaps 3 to 20 characters (by replacing + with {3,20} for instance). |
Matches |
DOMAIN\ssmith | DOMAIN\a | DOMAIN\username |
Non-Matches |
ssmith | username | DOMAIN\ |
Author |
Rating:
Not yet rated.
Steven Smith
|
Title |
Test
Details
Pattern Title
|
Expression |
^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)?((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)?(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&%\$#\=~_\-@]*)*$ |
Description |
None of the other URL regex's seemed to work right for me, so i threw this together. works well with PHP's ereg(). |
Matches |
http://www.sysrage.net | https://64.81.85.161/site/file.php?cow=moo's | ftp://user: [email protected]:123 |
Non-Matches |
sysrage.net |
Author |
Rating:
Not yet rated.
Brian Bothwell
|
Displaying page
of
pages;
Items to