RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

74 regular expressions found in this category!

Expressions in category: Uri

Change page:   |    Displaying page 2 of 4 pages; Items 21 to 40
Title Test Details Pattern Title
Expression
^(((ht|f)tp(s?))\://)?(www.|[a-zA-Z].)[a-zA-Z0-9\-\.]+\.(com|edu|gov|mil|net|org|biz|info|name|museum|us|ca|uk)(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$
Description
Version 1.3.0: I needed a regexp to validate URL's without the ht(f)tp(s):// and include North American domains (like .us and .ca) and there didn't seem to be one available...so I created one. It will also work with ASP QueryStrings and anchor URL's. If you have a problem with the expression or have any suggestions to improve, please write me and let me know. Added .uk domain and expression now allows for URLs that contain JSP session IDs. 4/14/04 - added ability to include URLs that start with server names.
Matches
www.blah.com:8103 | www.blah.com/blah.asp?sort=ASC | www.blah.com/blah.htm#blah
Non-Matches
www.state.ga | http://www.blah.ru
Author Rating: The rating for this expression. Brad Dobyns
Title Test Details Pattern Title
Expression
^([a-zA-Z]\:) (\\{1}| ((\\{1}) [^\\] ([^/:*?<>"|]*(?<![ ])))+)$
Description
Validates windows path and invalidates UNC path
Matches
c:\34\445\546\3.htm | C:\
Non-Matches
\\qaz | c:\Ram<\ | C: or c:\\ or \\
Author Rating: The rating for this expression. Gaurav Shrivastava
Title Test Details Pattern Title
Expression
(?!\.)[a-z]{1,4}$
Description
Matches files extension
Matches
file.jpg | file.c | file.gif
Non-Matches
file.34
Author Rating: The rating for this expression. Carlos R. L. Rodrigues
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: The rating for this expression. Joe Lynwood
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: The rating for this expression. James Johnston
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: The rating for this expression. Manpreet Grewal
Title Test Details Pattern Title
Expression
^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)*((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\.\,\?\'\\\+&amp;%\$#\=~_\-]+))*$
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: The rating for this expression. Brian Bothwell
Title Test Details Pattern Title
Expression
^\\([^\\]+\\)*[^\/:*?&quot;&lt;&gt;|]?$
Description
Orginally on this site search for Path, go to next page you see a reg expression for ^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?&quot;&lt;&gt;|]+\.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: The rating for this expression. Rod DeValcourt
Title Test Details Pattern Title
Expression
(^\d{3}\x2E\d{3}\x2E\d{3}\x2D\d{2}$)
Description
Brazilian cpf
Matches
123.123.123-12
Non-Matches
123.123.103.32 | 123 123 123 12 | sa3.332.322-12
Author Rating: The rating for this expression. Carlos R. L. Rodrigues
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: The rating for this expression. Jag fire
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: The rating for this expression. David Tersigni
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: The rating for this expression. Stewart Haddock
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\-\._\?\,\'/\\\+&amp;%\$#\=~])*$
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, - . _ ? , ' / \ + &amp; % $ # = ~). 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&quot;blah.com/I have spaces! | ftp://blah_underscore/[nope]
Author Rating: The rating for this expression. Brandon Luhring
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\&amp;%_\./-~-]*)?
Description
You can use this regular expression in your PHP scripts to convert entered URL in text to URL link. Example: $text=ereg_replace(&quot;(((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\&amp;%_\./-~-]*)?&quot;,&quot;&lt;a href=\&quot;./redir.php?url=\\0\&quot; target=\&quot;_blank\&quot;&gt;\\0&lt;/a&gt;&quot;,$text);
Matches
http://diskusneforum.sk | www.diskusneforum.sk | ftp://123.123.123.123/
Non-Matches
diskusneforum.sk
Author Rating: The rating for this expression. Martin Ille
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: The rating for this expression. Gregory Entin
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
http://www.aspemporium.com | mailto:[email protected] | ftp://ftp.test.com
Non-Matches
www.aspemporium.com | [email protected] | bloggs
Author Rating: The rating for this expression. Justin Saunders
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: The rating for this expression. Sjef van Leeuwen
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: The rating for this expression. Klaxon Mindjammer
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\-\&amp;]+[,]*){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\-\&amp;]+[,]*){2,})|((DC=['\w\d\s\-\&amp;]+[,]*){2,})$
Description
This expression gets a server bound or serverless ldap path without &quot;LDAP://&quot; 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
Change page:   |    Displaying page 2 of 4 pages; Items 21 to 40

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