74 regular expressions found in this category!
Displaying page
of
pages;
Items to
Title |
Test
Details
Pattern Title
|
Expression |
^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$ |
Description |
Cheap and cheerful URL checker. Requires a http/https/ftp at the start and will then allow anything starting with at least a <something>.<something>.<something> then valid characters separated by dots and slashes |
Matches |
http://www.thedaddy.org | http://forum.thedaddy.org/index.html | ftp://hows.it.going_buddy/checkit/o |
Non-Matches |
www.thedaddy.org | http://hello | ftp://check.it |
Author |
Rating:
John Main
|
Title |
Test
Details
Pattern Title
|
Expression |
(\s|\n|^)(\w+://[^\s\n]+) |
Description |
will match free floating valid protocol + urls in text ... will not touch the ones wrapped in a tag, so that you can auto-link the ones that aren't :) couple of things to know :
1. if the url is next to a tag this won't work (eg : <br>http://www.acme.com), the url must either start with a \s, \n or any character other than >.
2. the pattern will match the preceding \s and \n too, so when you replace put them back in place $1 will either be \s or \n, $2 will be the exact match
vb usage :
set re = New RegExp
re.Pattern ="(\s|\n|^)(\w+://[^\s\n]+)"
strResult = re.Replace(strText, "$1<a href='$2' target='_new'>$2</a>") |
Matches |
http://www.acme.com | ftp://ftp.acme.com/hede | gopher://asdfasd.asdfasdf |
Non-Matches |
<a href="http://acme.com">http://www.acme.com</a> | <br>http://www.acme. |
Author |
Rating:
ic onur
|
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])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$ |
Description |
Ok here's an updated URL regex for you folks. It allows localhost and all TLDs. Feel free to add each country code individually if you want a tighter match. |
Matches |
http://site.com/dir/file.php?var=moo | https://localhost | ftp://user: [email protected]:21/file/dir |
Non-Matches |
site.com | http://site.com/dir// |
Author |
Rating:
Brian Bothwell
|
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z0-9]+([a-zA-Z0-9\-\.]+)?\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$ |
Description |
Checks domain names. This is an attempt to deal with some of the issues of the other reg ex in not handling leading periods(.) and hypens(-). |
Matches |
my.domain.com | regexlib.com | big-reg.com |
Non-Matches |
.mydomain.com | regexlib.comm | -bigreg.com |
Author |
Rating:
Stewart Haddock
|
Title |
Test
Details
Pattern Title
|
Expression |
([\d\w-.]+?\.(a[cdefgilmnoqrstuwz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvxyz]|d[ejkmnoz]|e[ceghrst]|f[ijkmnor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eouw]|s[abcdeghijklmnortuvyz]|t[cdfghjkmnoprtvwz]|u[augkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]|aero|arpa|biz|com|coop|edu|info|int|gov|mil|museum|name|net|org|pro)(\b|\W(?<!&|=)(?!\.\s|\.{3}).*?))(\s|$) |
Description |
This will find URLs in plain text. With or without protocol. It matches against all toplevel domains to find the URL in the text. |
Matches |
http://www.website.com/index.html | www.website.com | website.com |
Non-Matches |
Works in all my tests. Does not capture protocol. |
Author |
Rating:
James Johnston
|
Title |
Test
Details
Pattern Title
|
Expression |
(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)? |
Description |
You can use this regular expression in your PHP scripts to convert entered URL in text to URL link. Example:
$text=ereg_replace("(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?","<a href=\"./redir.php?url=\\0\" target=\"_blank\">\\0</a>",$text); |
Matches |
http://diskusneforum.sk | www.diskusneforum.sk | ftp://123.123.123.123/ |
Non-Matches |
diskusneforum.sk |
Author |
Rating:
Martin Ille
|
Title |
Test
Details
Pattern Title
|
Expression |
^[a-zA-Z0-9]+([a-zA-Z0-9\-\.]+)?\.(aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly| ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk| pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr| st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zr|zw|AERO|BIZ|COM|COOP|EDU|GOV|INFO|INT|MIL|MUSEUM|NAME|NET|ORG|AC| |
Description |
Based of from Steward Haddock's domain nam
Checks domain names. This is an attempt to deal with some of the issues of the other reg ex in not handling leading periods(.), hypens(-). and valid extension. |
Matches |
mydomain.com | my-domain.info | mydomain.aero |
Non-Matches |
-mydomain.com | mydomain.aaa | .mydomain.com |
Author |
Rating:
Sjef van Leeuwen
|
Title |
Test
Details
Pattern Title
|
Expression |
^(\$|)([1-9]+\d{0,2}(\,\d{3})*|([1-9]+\d*))(\.\d{2})?$ |
Description |
By combining the contributions from Bri Gipson and Michael Ash in this site. I have come up with this RE to exclude the zero dollar amounts such as $0.00, 0.00, 0, etc. |
Matches |
$1,234,567.00 | $1234567.00 | 1234567.00 |
Non-Matches |
$1,2345,67.00 | $0 | $0.00 |
Author |
Rating:
Joe Lynwood
|
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:
Brandon Luhring
|
Title |
Test
Details
Pattern Title
|
Expression |
(?<http>(http:[/][/]|www.)([a-z]|[A-Z]|[0-9]|[/.]|[~])*) |
Description |
This is HTTP Url extractor |
Matches |
http://www.abc.com | www.mpgrewal.tk |
Non-Matches |
noida-India | crazy123 |
Author |
Rating:
Manpreet Grewal
|
Title |
Test
Details
Pattern Title
|
Expression |
^((?:2[0-5]{2}|1\d{2}|[1-9]\d|[1-9])\.(?:(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)\.){2}(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)):(\d|[1-9]\d|[1-9]\d{2,3}|[1-5]\d{4}|6[0-4]\d{3}|654\d{2}|655[0-2]\d|6553[0-5])$ |
Description |
IPv4 ip:port checker, I hope it will help you. $1 - IP, $2 - port. More to come, maybe :) |
Matches |
127.0.0.1:80 | 255.255.255.0:21 | 1.0.0.0:1 |
Non-Matches |
0.0.0.0:1 | 256.1.1.1:20 | 127.0.0.1:65536 |
Author |
Rating:
Brano Gerzo
|
Title |
Test
Details
Pattern Title
|
Expression |
^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$ |
Description |
Verifies URLs. Checks for the leading protocol, a good looking domain (two or three letter TLD; no invalid characters in domain) and a somwhat reasonable file path. |
Matches |
http://psychopop.org | http://www.edsroom.com/newUser.asp | http://unpleasant.jarrin.net/markov/inde |
Non-Matches |
ftp://psychopop.org | http://www.edsroom/ | http://un/pleasant.jarrin.net/markov/index.asp |
Author |
Rating:
Klaxon Mindjammer
|
Title |
Test
Details
Pattern Title
|
Expression |
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} |
Description |
Very Simple Match for dotted Decimal IP address. Doesn’t Validate addresses |
Matches |
192.168.1.1 | 10.2.234.1 | 66.129.71.122 |
Non-Matches |
192.168.1 | 10.2.1234.1 | 66 129 71 122 |
Author |
Rating:
David Tersigni
|
Title |
Test
Details
Pattern Title
|
Expression |
^(((((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])-(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]))|((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]))),)*)(((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- |
Description |
Matches comma-separated list of IP address and IP ranges. E.g. 192.168.101.1-192.168.101.255,192.168.102.12 |
Matches |
192.168.101.1 | 192.168.101.1-192.168.101.255 | 192.168.101.1-192.168.101.255,192.168.102.12 |
Non-Matches |
999.168.101.1 | 192.168.101.1- | -192.168.101.255 |
Author |
Rating:
Gregory Entin
|
Title |
Test
Details
Pattern Title
|
Expression |
^(([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+))$ |
Description |
Matches simple IP addresses. It's not too complex or long, but it does the job if you want something short/simple. |
Matches |
113.173.40.255 | 171.132.248.57 | 79.93.28.178 |
Non-Matches |
189.57.135 | 14.190.193999 | A.N.D.233 |
Author |
Rating:
Jag fire
|
Title |
Test
Details
Pattern Title
|
Expression |
((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+) |
Description |
Regular Expression matches any internet URLs. Used with the replace method it comes in very handy. |
Matches |
|
Non-Matches |
|
Author |
Rating:
Justin Saunders
|
Title |
Test
Details
Pattern Title
|
Expression |
^\\([^\\]+\\)*[^\/:*?"<>|]?$ |
Description |
Orginally on this site search for Path, go to next page
you see a reg expression for ^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?"<>|]+\.htm(l)?$
which I modified with this one to disallow drive specification. |
Matches |
\temp\ | \temp\content\ | \Program Files\ |
Non-Matches |
a:\Temp\ | \Temp\Content | c:\Program Files\ |
Author |
Rating:
Rod DeValcourt
|
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
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
|
Displaying page
of
pages;
Items to