74 regular expressions found in this category!
Displaying page
of
pages;
Items to
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 |
^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 |
^(([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}/(DC=['\w\d\s\-\&]+[,]*){2,})|((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])/(DC=['\w\d\s\-\&]+[,]*){2,})|((DC=['\w\d\s\-\&]+[,]*){2,})$ |
Description |
This expression gets a server bound or serverless ldap path without "LDAP://" in front of it. |
Matches |
aa.com/dc=ll,dc=ll | 181.168.5.5/dc=cc,dc=ll | dc=ll,dc=aa |
Non-Matches |
a/dc=aa | aa.com | 181.168.5.5 |
Author |
Rating:
Not yet rated.
Ariana Bauer
|
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 |
^(http|https|ftp)\://(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([a-zA-Z0-9_\-\.])+\.(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|uk|me))((:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*)$ |
Description |
First attempt at reg ex - work in progress - can't quite get it to work absolutely correctly so any comments would be great.
Matches everything as it should apart from the last part of the IP, i.e. allows http://255.255.255.999 (which obviously it shouldn't but ran out of inspiration) so any corrections humbly and gratefully accepted.
TLD check is not complete - just added most of the major ones but easy to dd to if you want to.
BTW - you'll need to replace the & with just the ampersand in the reg ex |
Matches |
http://www.allkins.com | http://255.255.255.255 | http://allkins.com/page.asp?action=1 |
Non-Matches |
http://test.testing |
Author |
Rating:
Not yet rated.
Dominic Allkins
|
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 |
^(?<link>((?<prot>http:\/\/)*(?<subdomain>(www|[^\-\n]*)*)(\.)*(?<domain>[^\-\n]+)\.(?<after>[a-zA-Z]{2,3}[^>\n]*)))$ |
Description |
I wrote this after I couldn't find an expression that would search for valid URLs, whether they had HTTP in front or not. This will find those that don't have hyphens anywhere in them (except for after the domain). |
Matches |
http://www.google.com | www.123google.com | www.google.com/help/me |
Non-Matches |
-123google.com | http://-123.123google.com |
Author |
Rating:
Not yet rated.
Joe Pontani
|
Title |
Test
Details
Pattern Title
|
Expression |
\b(((\S+)?)(@|mailto\:|(news|(ht|f)tp(s?))\://)\S+)\b |
Description |
Whilst writing a plain-text to HTML function, I ran into the problem of links that users had written with &lt;a&gt; tags (as opposed to just writing the URL) were linking improperly. This regular expression returns many types of URL, and preceding characters, if any. This allows you to handle each type of match appropriately |
Matches |
|
Non-Matches |
www.deepart.org | deepart.org | 123.123.123.123 |
Author |
Rating:
Not yet rated.
Demo Gorgon
|
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
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-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
|
Displaying page
of
pages;
Items to