Displaying page
of
pages;
Items to
| 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 |
((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:dominionx@hotmail.com | ftp://ftp.test.com |
| Non-Matches |
www.aspemporium.com | dominionx@hotmail.com | bloggs |
| Author |
Rating:
Justin Saunders
|
| Title |
Test
Details
Pattern Title
|
| Expression |
Last.*?(\d+.?\d*) |
| Description |
Plucks the last quote of a Stock from the MSN MoneyCentral WebQuote page for any given stock symbol. The URL of the web page where this RegEx should be applied is:
http://localhost/asp/webquote.htm?ipage=qd&Symbol=,give the stock symbol here> You must also use the singleline option. |
| Matches |
<TR><TD ALIGN=RIGHT>&nbsp;</TD><TD>Last</TD><TD ALIGN=RIGHT NOW |
| Non-Matches |
[AADDSS] |
| Author |
Rating:
Prasad DV
|
| 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 |
(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])? |
| Description |
*CORRECTED: Again thanks for all the comments below. If you want to include internal domain as well change the partial code (\.[\w-_]+)+ to (\.[\w-_]+)?
See the comments below*
This is the regular expression I use to add links in my email program. It also ignores those suppose-to-be commas/periods/colons at the end of the URL, like this sentence "check out http://www.yahoo.com/." (the period will be ignored) Note that it requires some modification to match ones that dont start with http. |
| Matches |
http://regxlib.com/Default.aspx | http://electronics.cnet.com/electronics/0-6342366-8-8994967-1.html |
| Non-Matches |
www.yahoo.com |
| Author |
Rating:
M H
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(?=[^&])(?:(?<scheme>[^:/?#]+):)?(?://(?<authority>[^/?#]*))?(?<path>[^?#]*)(?:\?(?<query>[^#]*))?(?:#(?<fragment>.*))? |
| Description |
Use it for breaking-down a URI (URL, URN) reference into its main components: Scheme, Authority, Path, Query and Fragment.
This is not a simple match regular expression. so it not works to verify a URI. It returns 1 matching group for each URI component.
For example, for the following URI:
http://regexlib.com/REDetails.aspx?regexp_id=x#Details
returns: scheme="http", authority="regexlib.com", path="/REDetails.aspx", query="regexp_id=x" and fragment="Details".
This is a W3C raccomandation (RFC 2396). |
| Matches |
http://regexlib.com/REDetails.aspx?regexp_id=x#Details |
| Non-Matches |
& |
| Author |
Rating:
Not yet rated.
Frederico Knabben
|
| 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:
Alban Schmid
|
| 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|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:
Michael Krutwig
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(("|')[a-z0-9\/\.\?\=\&]*(\.htm|\.asp|\.php|\.jsp)[a-z0-9\/\.\?\=\&]*("|'))|(href=*?[a-z0-9\/\.\?\=\&"']*) |
| Description |
Will locate an URL in a webpage.
It'll search in 2 ways - first it will try to locate a href=, and then go to the end of the link. If there is nu href=, it will search for the end of the file instead (.asp, .htm and so on), and then take the data between the "xxxxxx" or 'xxxxxx' |
| Matches |
href="produktsida.asp?kategori2=218" | href="NuclearTesting.htm" |
| Non-Matches |
U Suck |
| Author |
Rating:
Not yet rated.
Henric Rosvall
|
| 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 |
href='http://www.deepart.org' | demogorgon@deepart.org | ftp://123.123.123.123 |
| Non-Matches |
www.deepart.org | deepart.org | 123.123.123.123 |
| Author |
Rating:
Demo Gorgon
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(mailto\:|(news|(ht|f)tp(s?))\://)(([^[:space:]]+)|([^[:space:]]+)( #([^#]+)#)?) |
| Description |
this is a very little regex for use within a content management software. links within textfields has not to be written in html. the editor of the cms is instructed to use it like this: 1. mention spaces in front and behind the url 2. start url with http://, mailto://, ftp:// ... 3. use optional linktext within #linktext# (separated with single space) 4. if there is no linktext the url/email will show up as linktext 5. avoid url with spaces in filename (use %20 urldecode) replace pattern (space in front): <a href="\\1\\3\\4" target="_blank">\\3\\6</a> |
| Matches |
http://www.domain.com | http://www.domain.com/index%20page.htm #linktext# | mailto://user@domai |
| Non-Matches |
<a href="http://www.domain.com">real html link</a> | http://www.without_space_ |
| Author |
Rating:
Not yet rated.
Martin Schwedes
|
| 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:
Steven Smith
|
| 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:
Darren Neimke
|
| 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 |
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 |
^(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:pass@host.com:123 |
| Non-Matches |
sysrage.net |
| Author |
Rating:
Not yet rated.
Brian Bothwell
|
| 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:pass@site.com:21/file/dir |
| Non-Matches |
site.com | http://site.com/dir// |
| Author |
Rating:
Brian Bothwell
|
| 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:
Martin Matusiak
|
| 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:
Brad Dobyns
|
| 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
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 "/" 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:
Ariel Merrell
|
| 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:
Gerrard Lindsay
|
| 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 |
^(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 |
^((((H|h)(T|t)|(F|f))(T|t)(P|p)((S|s)?))\://)?(www.|[a-zA-Z0-9].)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,6}(\:[0-9]{1,5})*(/($|[a-zA-Z0-9\.\,\;\?\'\\\+&%\$#\=~_\-]+))*$ |
| Description |
Matches URLS that start with numbers and any TLD that is 2 to 6 characters long. Matches most URLs. Thanks to eveyone for suggesting modifications!
UPDATES::[Nov. 11, 2005] Now it matches uppercase and lower case protocols.
Updates::December 3, 2005 Added restriction to ports since they will only go up to 65535. (Thanks lorello)
Keep the suggestions coming! Thanks for the heads up!! |
| Matches |
hTtP://3iem.net/ | http://3iem.museum:1337/ | plik.co.uk |
| Non-Matches |
http://foobar | lameurl.toolongtld |
| Author |
Rating:
Phil Cogbill
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^((ht|f)tp(s?))\://([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(/\S*)?$ |
| Description |
Simple URL Validator -- allows http, https, ftp, ftps, 2-6 letter TLD, ports, any path. Sorry, no IP addresses. Not too fussy, but then, it's not too long either ;-) |
| Matches |
http://www.site.com | https://www.secure.com:10000 | ftp://ftp.site.com/pub/files/ |
| Non-Matches |
www.site.com | https://www.site.longtld | ftp:/badformat.com |
| Author |
Rating:
Luke Arms
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((ht|f)tp(s?))(:((\/\/)(?!\/)))(((w){3}\.)?)([a-zA-Z0-9\-_]+(\.(com|edu|gov|int|mil|net|org|biz|info|name|pro|museum|co\.uk)))(\/(?!\/))(([a-zA-Z0-9\-_\/]*)?)([a-zA-Z0-9])+\.((jpg|jpeg|gif|png)(?!(\w|\W))) |
| Description |
This expression matches valid image URLs. The main use for this would be in UBBC tags.
Written by RyanJ and Jick for FWD (http://flexwebdev.thenamesdan.com/) |
| Matches |
http://www.location.com/images/image1.gif | http://www.location.com/images/mainImgs/image1.png |
| Non-Matches |
/images/image1.jpeg | http://www.location.com/images/image1.swf | http://www.something.com/hello/..j |
| Author |
Rating:
Ryan Jones
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<\s*a\s[^>]*\bhref\s*=\s*
('(?<url>[^']*)'|""(?<url>[^""]*)""|(?<url>\S*))[^>]*>
(?<body>(.|\s)*?)<\s*/a\s*> |
| Description |
Suitable for extraction of all hyperlinks in the format:
<a ... href="..." ...> some text </a>
from a text document. Separates in groups the components of the links (url and body). |
| Matches |
<a href="javascript:'window.close()'">close the window</a> | <a target=&quo |
| Non-Matches |
<aa href="test.htm">test</a> | < a href hr = 'http://www.nakov.com'>...& |
| Author |
Rating:
Svetlin Nakov
|
| 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:
Joe Pontani
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(^[a-zA-Z][a-zA-Z0-9_]*)|(^[_][a-zA-Z0-9_]+) |
| Description |
This pattern can be used for validating a string as a valid element name (e.g. variable or class name) in Microsoft .NET. See also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vbconelementnames.asp |
| Matches |
var | _withunder_score99 | TeSt |
| Non-Matches |
_ | 123abc | 9 |
| Author |
Rating:
Not yet rated.
Howard Richards
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(((ht|f)tp(s?):\/\/)|(www\.[^ \[\]\(\)\n\r\t]+)|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})\/)([^ \[\]\(\),;"'<>\n\r\t]+)([^\. \[\]\(\),;"'<>\n\r\t])|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2}) |
| Description |
v2
A general purpose expresion to find url's (improved).
Add heads to first part, example:
((imap:|(ht|f)tp(s?):\/\/)|(www\.
to find url's like imap://www.com/, so ip's. No ipv6 (yet) |
| Matches |
www.domain.com | http://www.blah.ru | https://192.168.0.2:80/users/~fname.lname/file.ext |
| Non-Matches |
imap://.com |
| Author |
Rating:
Not yet rated.
James Tikitiki
|
| 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 |
href\s*=\s*(?:(?:\"(?<url>[^\"]*)\")|(?<url>[^\s*] ))>(?<title>[^<]+)</\w> |
| Description |
finds the url and url description for all links in a given text. |
| Matches |
<td bgcolor="#ffffff" class="small">&nbsp;<A HREF=" http:// |
| Non-Matches |
<td bgcolor="#ffffff" class="small">&nbsp;<A HREF http://www.thepla |
| Author |
Rating:
Matt Bruce
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\b([\d\w\.\/\+\-\?\:]*)((ht|f)tp(s|)\:\/\/|[\d\d\d|\d\d]\.[\d\d\d|\d\d]\.|www\.|\.tv|\.ac|\.com|\.edu|\.gov|\.int|\.mil|\.net|\.org|\.biz|\.info|\.name|\.pro|\.museum|\.co)([\d\w\.\/\%\+\-\=\&\?\:\\\"\'\,\|\~\;]*)\b |
| Description |
Url matching |
| Matches |
http://210.50.2.215/sd_new/WebBuilder.cgi?RegID=7449046&First=Ok&Upt=Ok&EditPage=3&S |
| Non-Matches |
Hmmmm |
| Author |
Rating:
Johky Cheng
|
| Title |
Test
Details
Pattern Title
|
| Expression |
^(((ht|f)tp(s?))\://)?((([a-zA-Z0-9_\-]{2,}\.)+[a-zA-Z]{2,})|((?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(\.?\d)\.)){4}))(:[a-zA-Z0-9]+)?(/[a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~]*)?$ |
| Description |
Hopefully an all-encompassing expression to validate a URL. Supports an optional protocol, either a domain or IP address, an optional port number and an optional path. |
| Matches |
this.com | https://this.com:8080/this/this.htm | ftp://255.255.255.255/ |
| Non-Matches |
.this.com | https://this.com:/ | ftps://255.256.255.255/ |
| Author |
Rating:
Not yet rated.
Tom Hartland
|
| Title |
Test
Details
Pattern Title
|
| Expression |
([^\=&]+)(?<!param1|param2|param3)\=([^\=&]+)(&)? |
| Description |
this regex eleminates all parameters from a html querry e.g.
param1=hans&param2=5&badparam=5
so bad param will be deleted from the params given. its usefull to clean up urls from unwanted params you not allow befor using the query string for further issues. |
| Matches |
param1=2¶m2=2¶m3=5¶m4=9 |
| Non-Matches |
none |
| Author |
Rating:
Ludwig Gramberg
|
| 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 |
^[http://www.|www.][\S]+$ |
| Description |
a simple url validation |
| Matches |
http://www.regexlib.com/Add.aspx | www.regexlib.com/Add.aspx |
| Non-Matches |
regexlib.com/Add.aspx |
| Author |
Rating:
Rahul Bhot
|
| Title |
Test
Details
URL
|
| Expression |
^((([hH][tT][tT][pP][sS]?|[fF][tT][pP])\:\/\/)?([\w\.\-]+(\:[\w\.\&%\$\-]+)*@)?((([^\s\(\)\<\>\\\"\.\[\]\,@;:]+)(\.[^\s\(\)\<\>\\\"\.\[\]\,@;:]+)*(\.[a-zA-Z]{2,4}))|((([01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}([01]?\d{1,2}|2[0-4]\d|25[0-5])))(\b\:(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)\b)?((\/[^\/][\w\.\,\?\'\\\/\+&%\$#\=~_\-@]*)*[^\.\,\?\"\'\(\)\[\]!;<>{}\s\x7F-\xFF])?)$ |
| Description |
Matches a URL string by: protocol,subdomain,domain,ip address,port number,path and/or filename |
| Matches |
http://regexlib.com | https://regexlib.com:80 | 66.129.120.94/Search.aspx |
| Non-Matches |
http:/regexlib.com | https://regexlib.com:65536 | 66.129.120.256/Search.aspx. |
| Author |
Rating:
Dean Dal Bozzo
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?<!\\)\[(\\\[|\\\]|[^\[\]]|(?<!\\)\[.*(?<!\\)\])*(?<!\\)\] |
| Description |
This regular expression will find the highest level groups within recursive tokens. For instance, if I have "This is [just [an] example] of the [expression]", it'll find [just [an] example] and [expression], and nothing else. It will also not find an escaped bracket expression. If you want to replace the bracket with curly braces or parenthesis, be careful. As an example, curly braces will be: (?<!\\)\{(\\\{|\\\}|[^\{\}]|(?<!\\)\{.*(?<!\\)\})*(?<!\\)\} |
| Matches |
[just] | [just [an] example] |
| Non-Matches |
\[just] |
| Author |
Rating:
Joaquin Jares
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(str\=)\s*(?<value>([a-zA-Z0-9\,\.]{1})*) |
| Description |
Finding the value behind the char '='. The Exp. is designed to find parametres in specified URL's. In this example it find tha value of "str=" |
| Matches |
http://www.mysite.com/?str=yes | http://www.mysite.com/?find1=not&str=yes | this is my test and |
| Non-Matches |
http://www.mysite.com/?find1=not | this is my test and str = no |
| Author |
Rating:
Mickey Jervin
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<img .+ src[ ]*=[ ]*\"(.+)\" |
| Description |
Gets the image url in an HTML <IMG> tag. |
| Matches |
<img src="test.jpg"> | <img align = "left" src = "test.jpg"&g |
| Non-Matches |
unknown |
| Author |
Rating:
Judah Himango
|
| Title |
Test
Details
Pattern Title
|
| Expression |
\b((?#optional port)(https?|ftp|file)://)?
(?#sub domain)([a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)+
(?#top domain)(com\b|edu\b|biz\b|gov\b|in(?:t|fo)\b|mil\b|net\b|org\b|[a-z][a-z]\b)
(?#optional port)(:\d+)?
(?#optional path)(/[-a-z0-9_:\@&?=+,.!/~*'%\$]*)*
(?#not ending in)(?<![.,?!])
(?#not enclosed in)(?!((?!(?:<a )).)*?(?:</a>))
(?#or enclosed in)(?!((?!(?:<!--)).)*?(?:-->)) |
| Description |
Yet Another URL Search. Useful for capturing URLs in raw text. Ignores URLs in HREF and comments. Turn off whitespacing to test! |
| Matches |
http://www.google.com | google.com | http://some-domain.net/very/long/path/123.html |
| Non-Matches |
subdomain.NonExistentTopDomain | <a href="http://www.google.com">www.google.com</ |
| Author |
Rating:
Simon Ferguson
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?:(?:http|https)://(?:(?:[^/&=()/§, ]*?)*\.)+(?:\w{2,3})+?)(?:/+[^ ?,'§$&()={\[\]}]*)*(?:\?+.*)?$ |
| Description |
I don't give a f*** to the RFC, fix it yourself for RFC, I just need a valid webresource location. So add forbidden characters as you need them in the character classes or use it as it is. This RegEx is not for searching valid URLs, just for validating. Look at the trailing $. |
| Matches |
http://www.test.org | http://www.test.org/page1 | http://www.test.org/folder/subfolder/page.html?get |
| Non-Matches |
http://www.test.org% | http://www.test.org/hgh(s/ | http://www.test.org/hehe/notallowed&/page1.h |
| Author |
Rating:
Lars Echterhoff
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((http|ftp|https):\/\/w{3}[\d]*.|(http|ftp|https):\/\/|w{3}[\d]*.)([\w\d\._\-#\(\)\[\]\\,;:]+@[\w\d\._\-#\(\)\[\]\\,;:])?([a-z0-9]+.)*[a-z\-0-9]+.([a-z]{2,3})?[a-z]{2,6}(:[0-9]+)?(\/[\/a-z0-9\._\-,]+)*[a-z0-9\-_\.\s\%]+(\?[a-z0-9=%&\.\-,#]+)? |
| Description |
Here is my first regexp. I hope you like it! It parses quite a few different urls, although it's not a high-quality regexp. Http, Ftp protocols are supported, parameters and anchors too. |
| Matches |
www.yahoo.com | ftp://user:pass@host.com:123 | http://localhost/page2.php?a=b&c=d#hello |
| Non-Matches |
website.net |
| Author |
Rating:
Francis Marass
|
| Title |
Test
Details
Pattern Title
|
| Expression |
((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)\:\/\/([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@){0,1}((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]{2,5}[^:]){0,1}(\/(\s+|$|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+)){0,1}) |
| Description |
Modified version of Brian Bothwell's valid url submission. Eliminates a couple of the user discovered bugs, expands protocol recognition and considers trailing / |
| Matches |
file://test.com/ | http://www.test.com:80/ | ftp://user@localhost/dir |
| Non-Matches |
test.com | www.test.com:80:80 | https://user@user@test.com |
| Author |
Rating:
Not yet rated.
Douglas Hurst
|
| Title |
Test
Details
Pattern Title
|
| Expression |
(?<url>
(?<protocol>
http(s?)
|
ftp
)\:\/\/
(?<host>
(?<hostname>
(
(?<subdomain>
([a-z]\w*\.)*[a-z]\w*
)\.
)?
(
(?<ip>
(\d{1,3}\.){3}\d{1,3}
)
|
(
(?<org>
[a-z]\w*
)\.
(?<domain>
[a-z]{2,3}
)
)
)
)?
(\:
(?<port>
\d+
)
)?
)
(?<path>
(?<directory>
(\/.*)*\/
)?
(?<file>
[a-z]\w*\.\w+
)?
)?
(\#
(?<hash>
[^?\n\r]+
)
)?
(\?
(?<search>
(\&?[^\=\n\r]+\=[^\&\n\r]*)+
)
)?
) |
| Description |
Thanks to Ariel Merrell, as well as the folks who developed the javascript location object for some of the inspiration for this.
This was intended primarily to help break down the parts of a URL for easier processing, and not as a validator. Please make sure the following options are met
- .Net RE
- Case Insensitive
- Ignore pattern whitespace
- Explicit Capture.
|
| Matches |
https://MySubDomain.123.0.0.1:443/MyDir/MySubDir/MyFile.html#MyHash?q=5%432&q2=paramval | http:/ |
| Non-Matches |
SomeDomain.com |
| Author |
Rating:
Not yet rated.
Chris Strolia-Davis
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<a[a-zA-Z0-9 ="'.:;?]*(href=[\"\'](http:\/\/|\.\/|\/)?\w+(\.\w+)*(\/\w+(\.\w+)?)*(\/|\?\w*=\w*(&\w*=\w*)*)?[\"\'])*(>[a-zA-Z0-9 ="'<>.:;?]*</a>) |
| Description |
i've merged two regular expression those i found on this site. thanks to the owners "Aleš Potocnik and
Andrew Lee ". i used their expression to make mine. this expression finds the URL/Hyperlink with the HTML tags. |
| Matches |
<a href="http://www.google.co.in/hi">Hindi</a> |
| Non-Matches |
href="http://www.google.co.in/hi" |
| Author |
Rating:
Not yet rated.
himraj love
|
| Title |
Test
Details
Pattern Title
|
| Expression |
<a.*?href=(.*?)(?((?:\s.*?)>.*?</a>)(?:(?:\s.*?)>(.*?)</a>)|(?:>(.*?)</a>)) |
| Description |
this Expression use conditional expression to eveluate parameter after "HREF" and executes the yes/no part of the expression. this expression finds <A> TAG and returns value of "HREF" and the value hold in between <a></a> tags. the expression returns maximum 3 sub matches. the first match returns the "HREF" tag value and rest of two holds the value of the tag alternativly. so after executing the expression you need to itarate through all the submatches and need to find out non NULL tags to get value.
the output of the above matching expamples would be like this :
1: "/url?sa=p&pref=ig&pval=2&q=http://www.google.co.in/ig%3Fhl%3Den"
2:[Personalized Home]
3:[] or NULL
the output of the second matching example would be like this.
1:/advanced_search?hl=en
2:[] or NULL
3:[Advanced Search] |
| Matches |
<a href="/url?sa=p&pref=ig&pval=2&q=http://www.google.co.in/ig%3Fhl%3Den" o |
| Non-Matches |
none |
| Author |
Rating:
himraj love
|
| Title |
Test
Details
URL Test
|
| Expression |
(?#WebOrIP)((?#protocol)((http|https):\/\/)?(?#subDomain)(([a-zA-Z0-9]+\.(?#domain)[a-zA-Z0-9\-]+(?#TLD)(\.[a-zA-Z]+){1,2})|(?#IPAddress)((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])))+(?#Port)(:[1-9][0-9]*)?)+(?#Path)((\/((?#dirOrFileName)[a-zA-Z0-9_\-\%\~\+]+)?)*)?(?#extension)(\.([a-zA-Z0-9_]+))?(?#parameters)(\?([a-zA-Z0-9_\-]+\=[a-z-A-Z0-9_\-\%\~\+]+)?(?#additionalParameters)(\&([a-zA-Z0-9_\-]+\=[a-z-A-Z0-9_\-\%\~\+]+)?)*)? |
| Description |
I needed a regex for validating URLs, couldn't find a suitable one, so wrote this, with comments! It matches any valid web URL (Address or IP, with or without protocol), including optional port number, directory path, filname.extension and any paramater pairs. Hope it helps, even if just to understand expressions easier! |
| Matches |
www.test.com|http://www.test.com|234.232.12.23:8080|sub.test.com/dir/file.ext?param=val¶m2=val2 |
| Non-Matches |
/file.htm|256.0.0.0 |
| Author |
Rating:
David Barker
|
| Title |
Test
Details
RFC URL
|
| Expression |
(([\w]+:)?//)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)? |
| Description |
A pretty decent URL matching expression. I've followed most RFC guidelines, so it'll match most anything ya throw at it (And wont match what it's not supposed to). If you see any problems with it, please email me so I can make the appropriate changes :) |
| Matches |
http://www.domain.com | http://domain.com | http://domain.com | https://domain.com | https://sub.domain-name.com:8080 | http://domain.com/dir%201/dir_2/program.ext?var1=x&var2=my%20value | domain.com/index.html#bookmark |
| Non-Matches |
Normal Text. | http://a.com | http://www.domain-.com |
| Author |
Rating:
r4cc00n
|
| Title |
Test
Details
Matching urls in free text
|
| Expression |
((www|http)(\W+\S+[^).,:;?\]\} \r\n$]+)) |
| Description |
A regular expression which allows me to find strings of text floating around in free text that are in fact URLs. I need to tag these as <url>www.bmj.com/advice</url>. The problem has been allowing special characters in the url, but not mixing them up with genuine punctuation marks at the end of the url in the text-e.g. '.' or '?' or ) or ';' etc) |
| Matches |
www.bmjpg.com/advice&search=?light+dark |
| Non-Matches |
www.bmjpg.com/advice&search=?light+dark? |
| Author |
Rating:
Sean Harrop
|
| Title |
Test
Details
Img Src Attribute
|
| Expression |
src=(?:\"|\')?(?<imgSrc>[^>]*[^/].(?:jpg|bmp|gif|png))(?:\"|\')? |
| Description |
This pattern matches an image url attribute of an img html tag. It searches for the src attribute and grabs the value as a grouped match - "imgSrc". |
| Matches |
src="http://www.thoughtlava.com/images/logo.gif" | src='http://www.thoughtlava.com/images/logo.gif' | src=http://www.thoughtlava.com/images/logo.gif |
| Non-Matches |
src="http://www.thoughtlava.com/images/logo.wmf" |
| Author |
Rating:
Steven Pena
|
| Title |
Test
Details
Simple App Relative Path
|
| Expression |
^~/[0-9a-zA-Z_][0-9a-zA-Z/_-]*\.[0-9a-zA-Z_-]+$ |
| Description |
Matches the app relative path of a file. This will work for relative paths of URLs. Not very complicated but will work to do basic validation. |
| Matches |
~/myPage.htm | ~/123._aBc2 | ~/Hello_World-Page.aspx |
| Non-Matches |
mybadPage.htm | ~/.Not | ~/Very. | ~/Good |
| Author |
Rating:
C. Brendan Enrick
|
| Title |
Test
Details
Strip Domain from URL
|
| Expression |
http://[^/]*/ |
| Description |
I was looking for a long time for a simple regex to strip the domain name from a long url or to Get rid of directories and pages. I found a simple one that I wanted to share. If you have http://www.google.com/products/bob?gmail.ckj it will return only http://www.google.com getting rid of all the other parts of the url |
| Matches |
http://www.google.com |
| Non-Matches |
http://www.google.com/products/bob?gmail.ckj |
| Author |
Rating:
Not yet rated.
Adil Berdai
|
| Title |
Test
Details
JDBC DB2 Url
|
| Expression |
^jdbc:db2://((?:(?:(?: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]?))|(?:(?:(?:(?:[A-Z|a-z])(?:[\w|-]){0,61}(?:[\w]?[.]))*)(?:(?:[A-Z|a-z])(?:[\w|-]){0,61}(?:[\w]?)))):([0-9]{1,5})/([0-9|A-Z|a-z|_|#|$]{1,16})$ |
| Description |
Pattern for testing a jdbc db2 url (Type 4). Format jdbc:db2://<ServerName><Port>/<DatabaseName> |
| Matches |
jdbc:db2://MyServer:50008/MyDb or jdbc:db2://10.1.63.57:50008/MyDb |
| Non-Matches |
jdbc:db2://MyServer/MyDb |
| Author |
Rating:
Not yet rated.
Martin Egli
|
| Title |
Test
Details
Email - RFC 3696
|
| Expression |
^[a-z0-9!$'*+\-_]+(\.[a-z0-9!$'*+\-_]+)*@([a-z0-9]+(-+[a-z0-9]+)*\.)+([a-z]{2}|aero|arpa|biz|cat|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|travel)$ |
| Description |
Checks email format against RFC 3696 (http://tools.ietf.org/html/rfc3696). Allows all characters described in Sections 2 and 3 of the RFC EXCEPT those described in Section 4.3 as unsafe for mailto URLs without encoding. Allows any 2-letter TLD plus any of the current gTLDs as listed at http://www.icann.org/registries/top-level-domains.htm. Does not accept quoted strings in the local part or IP addresses in lieu of the domain name. Does not enforce length limits. Intended to be used as case-insensitive. Comments are appreciated! |
| Matches |
bob@smith.com | bob.j@j.smith.museum | !$'*+-_@a--1.ca |
| Non-Matches |
.bob@smith.com | bob..j@smith.com | bob@-smith.com |
| Author |
Rating:
Not yet rated.
David Thompson
|
| Title |
Test
Details
vaildate URL
|
| Expression |
^[http|ftp|wap|https]{3,5}:\//\www\.\w*\.[com|net]{2,3}$ |
| Description |
it validates a simple URL like http://www.google.com , ftp://www.soso.com |
| Matches |
http://www.google.com |
| Non-Matches |
httpp://wwww.go.com.in |
| Author |
Rating:
Not yet rated.
rob
|
| Title |
Test
Details
Hyperlink
|
| Expression |
<a\s{1}href="(?<url>.*?)"(\s?target="(?<target>_(blank|new|parent|self|top))")?(\s?class="(?<class>.*?)")?(\s?style="(?<style>.*?)")?>(?<title>.*?)</a> |
| Description |
Get the URL, target, class, style and description from a hyperlink |
| Matches |
<a href="www.test.com" target="_blank" class="testclass" style="padding:0;">This is a test link</a> |
| Non-Matches |
www.test.com |
| Author |
Rating:
Not yet rated.
Matt Jones
|
| Title |
Test
Details
HTML Anchor tag
|
| Expression |
<a\s+(?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?>[^<]+</a> |
| Description |
This will match an entire HTML tag and will capture the href portion into the named capture "url". It will match any anchor tag with any number of attributes. |
| Matches |
The entire <a href=""></a> tag |
| Non-Matches |
Links that include any html within the tag. |
| Author |
Rating:
Not yet rated.
Derek Pinkerton
|
| Title |
Test
Details
HTML Anchor (link) tag
|
| Expression |
<a\s+(?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?>.+?</a> |
| Description |
This regex will match all html link tags and captures the url into a named capture "url". There can be any html code between the opening and closing link tags. You must use this with the multiline and ignore case options selected. |
| Matches |
Any html link (anchor) tag with any content between the opening and closing link tags |
| Non-Matches |
all other html tags, link tags without an href section. |
| Author |
Rating:
Derek Pinkerton
|
| Title |
Test
Details
url
|
| Expression |
(?:(?:(?:http|ftp|gopher|telnet|news)://)(?:w{3}\.)?(?:[a-zA-Z0-9/;\?&=:\-_\$\+!\*'\(\|\\~\[\]#%\.])+) |
| Description |
an expression to match internet addresses with one of the known protocolls (http, ftp, gopher, telnet, news) |
| Matches |
http://ifi.lmu.de | ftp://leo.org | gopher://gopher.com |
| Non-Matches |
www.google.com |
| Author |
Rating:
Kis Hajnalka
|
| Title |
Test
Details
url
|
| Expression |
(?:(?:[a-zA-Z0-9/;\?&=:\-_\$\+!\*'\(\|\\~\[\]#%\.](?!www))+(?:\.[Cc]om|\.[Ee]du|\.[gG]ov|\.[Ii]nt|\.[Mm]il|\.[Nn]et|\.[Oo]rg|\.[Bb]iz|\.[Ii]nfo|\.[Nn]ame|\.[Pp]ro|\.[Aa]ero|\.[cC]oop|\.[mM]useum|\.[Cc]at|\.[Jj]obs|\.[Tt]ravel|\.[Aa]rpa|\.[Mm]obi|\.[Aa]c|\.[Aa]d|\.[aA]e|\.[aA]f|\.[aA]g|\.[aA]i|\.[aA]l|\.[aA]m|\.[aA]n|\.[aA]o|\.[aA]q|\.[aA]r|\.[aA]s|\.[aA]t|\.[aA]u|\.[aA]w|\.[aA]z|\.[aA]x|\.[bB]a|\.[bB]b|\.[bB]d|\.[bB]e|\.[bB]f|\.[bB]g|\.[bB]h|\.[bB]i|\.[bB]j|\.[bB]m|\.[bB]n|\.[bB]o|\.[bB]r|\.[bB]s|\.[bB]t|\.[bB]v|\.[bB]w|\.[bB]y|\.[bB]z|\.[cC]a|\.[cC]c|\.[cC]d|\.[cC]f|\.[cC]g|\.[cC]h|\.[cC]i|\.[cC]k|\.[cC]l|\.[cC]m|\.[cC]n|\.[cC]o|\.[cC]r|\.[cC]s|\.[cC]u|\.[cC]v|\.[cC]x|\.[cC]y|\.[cC]z|\.[dD]e|\.[dD]j|\.[dD]k|\.[dD]m|\.[dD]o|\.[dD]z|\.[eE]c|\.[eE]e|\.[eE]g|\.[eE]h|\.[eE]r|\.[eE]s|\.[eE]t|\.[eE]u|\.[fF]i|\.[fF]j|\.[fF]k|\.[fF]m|\.[fF]o|\.[fF]r|\.[gG]a|\.[gG]b|\.[gG]d|\.[gG]e|\.[gG]f|\.[gG]g|\.[gG]h|\.[gG]i|\.[gG]l|\.[gG]m|\.[gG]n|\.[gG]p|\.[gG]q|\.[gG]r|\.[gG]s|\.[gG]t|\.[gG]u|\.[gG]w|\.[gG]y|\.[hH]k|\.[hH]m|\.[hH]n|\.[hH]r|\.[hH]t|\.[hH]u|\.[iI]d|\.[iI]e|\.[iI]l|\.[iI]m|\.[iI]n|\.[iI]o|\.[iI]q|\.[iI]r|\.[iI]s|\.[iI]t|\.[jJ]e|\.[jJ]m|\.[jJ]o|\.[jJ]p|\.[kK]e|\.[kK]g|\.[kK]h|\.[kK]i|\.[kK]m|\.[kK]n|\.[kK]p|\.[kK]r|\.[kK]w|\.[kK]y|\.[kK]z|\.[lL]a|\.[lL]b|\.[lL]c|\.[lL]i|\.[lL]k|\.[lL]r|\.[lL]s|\.[lL]t|\.[lL]u|\.[lL]v|\.[lL]y|\.[mM]a|\.[mM]c|\.[mM]d|\.[mM]g|\.[mM]h|\.[mM]k|\.[mM]l|\.[mM]m|\.[mM]n|\.[mM]o|\.[mM]p|\.[mM]q|\.[mM]r|\.[mM]s|\.[mM]t|\.[mM]u|\.[mM]v|\.[mM]w|\.[mM]x|\.[mM]y|\.[mM]z|\.[nN]a|\.[nN]c|\.[nN]e|\.[nN]f|\.[nN]g|\.[nN]i|\.[nN]l|\.[nN]o|\.[nN]p|\.[nN]r|\.[nN]u|\.[nN]z|\.[oO]m|\.[pP]a|\.[pP]e|\.[pP]f|\.[pP]g|\.[pP]h|\.[pP]k|\.[pP]l|\.[pP]m|\.[pP]n|\.[pP]r|\.[pP]s|\.[pP]t|\.[pP]w|\.[pP]y|\.[qP]a|\.[rR]e|\.[rR]o|\.[rR]u|\.[rR]w|\.[sS]a|\.[sS]b|\.[sS]c|\.[sS]d|\.[sS]e|\.[sS]g|\.[sS]h|\.[Ss]i|\.[sS]j|\.[sS]k|\.[sS]l|\.[sS]m|\.[sS]n|\.[sS]o|\.[sS]r|\.[sS]t|\.[sS]v|\.[sS]y|\.[sS]z|\.[tT]c|\.[tT]d|\.[tT]f|\.[tT]g|\.[tT]h|\.[tT]j|\.[tT]k|\.[tT]l|\.[tT]m|\.[tT]n|\.[tT]o|\.[tT]p|\.[tT]r|\.[tT]t|\.[tT]v|\.[tT]w|\.[tT]z|\.[uU]a|\.[uU]g|\.[uU]k|\.[uU]m|\.[uU]s|\.[uU]y|\.[uU]z|\.[vV]a|\.[vV]c|\.[vV]e|\.[vV]g|\.[vV]i|\.[vV]n|\.[vV]u|\.[wW]f|\.[wW]s|\.[yY]e|\.[yY]t|\.[yY]u|\.[zZ]a|\.[zZ]m|\.[zZ]w)) |
| Description |
here are specified all the top level domains. In fact, this expression gets the urls only till the TLD. |
| Matches |
webmail.ifi.lmu.de |
| Non-Matches |
kis.hajnalka |
| Author |
Rating:
Kis Hajnalka
|
| Title |
Test
Details
url
|
| Expression |
(?:(?:w{3}\.)(?:[a-zA-Z0-9/;\?&=:\-_\$\+!\*'\(\|\\~\[\]#%\.])+[\.com|\.edu|\.gov|\.int|\.mil|\.net|\.org|\.biz|\.info|\.name|\.pro|\.aero|\.coop|\.museum|\.cat|\.jobs|\.travel|\.arpa|\.mobi|\.ac|\.ad|\.ae|\.af|\.ag|\.ai|\.al|\.am|\.an|\.ao|\.aq|\.ar|\.as|\.at|\.au|\.aw|\.az|\.ax|\.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|\.eu|\.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|\.sv|\.sy|\.sz|\.tc|\.td|\.tf|\.tg|\.th|\.tj|\.tk|\.tl|\.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|\.zw](?:[a-zA-Z0-9/;\?&=:\-_\$\+!\*'\(\|\\~\[\]#%\.])*) |
| Description |
So, that's it. Gets url-s with "www", BUT without the protocols. If you need one regEx with the protocols, search for it in this database, I've added one |
| Matches |
www.google.com |
| Non-Matches |
http://www.google.com |
| Author |
Rating:
Not yet rated.
Kis Hajnalka
|
| Title |
Test
Details
Path from jar
|
| Expression |
jar:file:/(([A-Z]:)?/([A-Z 0-9 * ( ) + \- & $ # @ _ . ! ~ /])+)(/[A-Z 0-9 _ ( ) \[ \] - = + _ ~]+\.jar!) |
| Description |
In java using this.getClass().getResource(""); will result in a jar:file:/ etc url ending with yourjarfile.jar!/internal/package/path/ this regular expression matches the directory before the internal jar path declaration returning the physical directory the file resides in. should work in both posix and windows machines (untested for posix*) |
| Matches |
jar:file:/C:/installation/path/jarfile.jar!/com/regexlib/example |
| Non-Matches |
Any text not using internal jar file url |
| Author |
Rating:
Alex Ries
|
| Title |
Test
Details
URL Parsing Regex
|
| Expression |
(?<protocol>http(s)?|ftp)://(?<server>([A-Za-z0-9-]+\.)*(?<basedomain>[A-Za-z0-9-]+\.[A-Za-z0-9]+))+((/?)(?<path>(?<dir>[A-Za-z0-9\._\-]+)(/){0,1}[A-Za-z0-9.-/]*)){0,1} |
| Description |
This regex matches fully qualified external urls (http, https, or ftp). It uses the ms specific group-naming structure to present friendly named groups back to the user. |
| Matches |
http://www.myserver.mydomain.com/myfolder/mypage.aspx |
| Non-Matches |
www.myserver.mydomain.com/myfolder/mypage.aspx |
| Author |
Rating:
Scott Sargent
|
| Title |
Test
Details
Relative paths in HTML
|
| Expression |
(<(?:.*?)\s)href\s*=([\s"'])*/?([^\2:#]+?)\2((?:.*?)>) |
| Description |
This expression matches all HREF relative paths, but not full URLs or dead # links. It can be used for selecting paths that need to be updated in HTML that has replaced from its original page onto a new one. It matches the entire containing tag with the following groups: 1 - the start of the containing tag through the space before the attribute, 2 - the delimiter between the attribute's equal sign and its value (e.g. a double quote), 3 - the attribute value, 4 - the remainder of the tag after the closing attribute value delimiter. |
| Matches |
<a href="joe's test.htm" /> | <a href='/test2.htm'> | <a href = test2.htm /> |
| Non-Matches |
<a href="http://www.test.com/test.htm" /> | <a href = '#' /> |
| Author |
Rating:
Not yet rated.
Joe Theriault
|
| Title |
Test
Details
website URL
|
| Expression |
(http://|)(www\.)?([^\.]+)\.(\w{2}|(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum))$ |
| Description |
I think this is one of the website url we can validate |
| Matches |
http://www.proarchitsoulutions.com |
| Non-Matches |
ww.proarchitsolutions.com | ftp://ftp.omega.com |
| Author |
Rating:
kiran kumar
|
| Title |
Test
Details
Link Text and URL from anchor
|
| Expression |
<a.+?href\=(?<link>.+?)(?=[>\s]).*?>(?<lnkText>.+?)</a> |
| Description |
Captures an html anchors URL and Link Text. Could be used to clean up formatting of links in an html document. |
| Matches |
<a href=http://capturedLink target=blah>captured Text</a>|<a class="blah" href="http://capturedLink" target="blah">captured Text</a> |
| Non-Matches |
Any other html tags |
| Author |
Rating:
Ariel Merrell
|
| Title |
Test
Details
Easiest URL Link
|
| Expression |
(http://|https://)([a-zA-Z0-9]+\.[a-zA-Z0-9\-]+|[a-zA-Z0-9\-]+)\.[a-zA-Z\.]{2,6}(/[a-zA-Z0-9\.\?=/#%&\+-]+|/|) |
| Description |
As always, I couldn't find a regex that worked for me. It only covers full urls with http:// and https://, obviously if you want to add ftp:// then change the first part to: (http://|https://|ftp://) etc..., you get my drift. If you want to cover everything, like short urls, try this site: http://internet.ls-la.net/folklore/url-regexpr.html |
| Matches |
http://www.url.com, http://www.url.com.au, http://www.url.co.nz, http://www.url123.com, http://www.url-123.com, http://www.url.com/, http://www.url.com/page.html, http://www.url.com/page.asp?id=you123&num=%60&pass=big-long+password#anchor |
| Non-Matches |
http://www.url.1com, http://www.url.com.1au |
| Author |
Rating:
Oz
|
| Title |
Test
Details
RegEx for email validation
|
| Expression |
/^([a-zA-Z0-9])(([\-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-z]{2,3}[.]{1}[a-z]{2,3}))$/ |
| Description |
This expresssion will validate all possible formats except if web site URL contains hyphen characters like aa@a-b-c.com. I will include this feature also in next version. |
| Matches |
a@abc.com,a@abc.co.in,aa.bb@abc.com.sg,aa_bb@abc.biz,aa.C.bb@abc.com,aa_1900@abc.co.in |
| Non-Matches |
@abc.com,a@abc.co.in.in,a@abc.com.in.in,a@a-b-c.com |
| Author |
Rating:
Rafiq
|
| Title |
Test
Details
URL
|
| Expression |
^((http|https|ftp)\://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,4}(/[a-zA-Z0-9\-\._\?=\,\'\+%\$#~]*[^\.\,\)\(\s])*$ |
| Description |
Matches any valid URLs which can activate links in a text. |
| Matches |
www.something.com | http://something.com/something?action=delete | http://www.something.com/~etc |
| Non-Matches |
http://www.something.com/, | wwww.something.com | |
| Author |
Rating:
Viktor Nagy
|
| Title |
Test
Details
url validation
|
| Expression |
(((ht|f)tp(s?):\/\/)|(([\w]{1,})\.[^ \[\]\(\)\n\r\t]+)|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2})\/)([^ \[\]\(\),;"'<>\n\r\t]+)([^\. \[\]\(\),;"'<>\n\r\t])|(([012]?[0-9]{1,2}\.){3}[012]?[0-9]{1,2}) |
| Description |
url validation with tiped errors |
| Matches |
w.example.com|wwww.example.com |
| Non-Matches |
example.com |
| Author |
Rating:
Not yet rated.
jose aviles
|
| Title |
Test
Details
Smarter URL extractor from plain text
|
| Expression |
(http(s?)://|[a-zA-Z0-9\-]+\.)[a-zA-Z0-9/~\-]+\.[a-zA-Z0-9/~\-_,&\?\.;]+[^\.,\s<] |
| Description |
This regex avoids matching typical mistakes where a sentence ends but there is no space after the full stop (period). Other regexes will think any two words with a dot in between is a URL! My regex does not require http:// and if there isn't http:// it will need to find AT LEAST two dots to guarantee its likely to be a URL and not a sentence that's missing a space like this.It will match www.test.com, http://test.com, test.com/index.htm but it will NOT match test.com. It will not match a dot or a comma at the very end which some people may type when including a URL in a sentence like this www.test.com, or this www.test.com. |
| Matches |
sub.test.com |
| Non-Matches |
test.com |
| Author |
Rating:
Gary F
|
| Title |
Test
Details
HTML href
|
| Expression |
(?i)(?s)<a[^>]+?href="?(?<url>[^"]+)"?>(?<innerHtml>.+?)</a\s*> |
| Description |
Matches a complete HTML href tag, placing the URL into a group named "url" and the innerHTML into a group named "innerHtml" |
| Matches |
<a href="http://regexplib.com">Inner <span>html</span></a> |
| Non-Matches |
<a href="http://regexplib.com"> |
| Author |
Rating:
Kevin Spencer
|
| Title |
Test
Details
Validate URL
|
| Expression |
^((http://)|(https://))((([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*))|(([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*).?([a-zA-Z0-9_-]*)))/?([a-zA-Z0-9_/?%=&+#.-~]*)$ |
| Description |
A regex I came up with for validating urls, didn't test thoroughly but seems to do the trick. |
| Matches |
http://sportsalert.net, https://www.sportsalert.net, http://sportsalert.net.uk, http://sportsalert.net/index.html, http://sportsalert.net/subdirectory, http://sportsalert.net?var1=param1&var2=param2 |
| Non-Matches |
www.sportsalert.net, http://.sportsalert.net, http://sportsalert..net |
| Author |
Rating:
Justin Toth
|
| Title |
Test
Details
URL Validator
|
| Expression |
^(http(?:s)?\:\/\/[a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*\.[a-zA-Z]{2,6}(?:\/?|(?:\/[\w\-]+)*)(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$ |
| Description |
A simple but powerful URL validating regex. Accepts multiple subdomains and subdirectories. Even accept query strings.
Does not accept ports. That's not what this is for.
UPDATED! with user's suggestions.
Accepts http or https.
Removed underscores from domain name.
Accepts optional "/" on end of address. |
| Matches |
http://website.com | http://subdomain.web-site.com/cgi-bin/perl.cgi?key1=value1&key2=value2 |
| Non-Matches |
http://website.com/perl.cgi?key= | http://web-site.com/cgi-bin/perl.cgi?key1=value1&key2 |
| Author |
Rating:
Ted Cambron
|
| Title |
Test
Details
Image URL
|
| Expression |
^(http\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(?:\/\S*)?(?:[a-zA-Z0-9_])+\.(?:jpg|jpeg|gif|png))$ |
| Description |
A nice little regex to verify a URL pointing towards an image. Can be useful. |
| Matches |
http://website.com/directory/image.gif |
| Non-Matches |
www.website.com/image.php |
| Author |
Rating:
Not yet rated.
Ted Cambron
|
| Title |
Test
Details
Number limiting x digits before decimal, and y digits after decimal point.
|
| Expression |
^([0-9]{0,5}|[0-9]{0,5}\.[0-9]{0,3})$ |
| Description |
This regular expression is intended to limit numeric entries by allowed places before and after the decimal point. It also recognizes whole numbers. In this example the value cannot exceed 99999.999. To change the range, simply edit the numbers in curly braces. For example, to allow 7 digits (millions) before the decimal point, change both instances of {0,5} to {0,7}. Likewise, to change the decimals from allowing thousandths (3 digits) to just hundreths, change the {0,3} to {0,2}. This can be useful for numeric fields in SQL. This example was made to accommodate a numeric(8,3) field definition. |
| Matches |
0 | 1 | 1.55 | 54321.123 | .12 |
| Non-Matches |
abc | 654321 | 12..34 | .1234 |
| Author |
Rating:
Ken Palmer
|
| Title |
Test
Details
Query String Regex
|
| Expression |
^((?:\?[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$ |
| Description |
This is a very simple regex that check the query part of a string. That is to say anything after the "?" at the end of an URL. |
| Matches |
?key=value | ?key1=value1&key2=value2 |
| Non-Matches |
key=value | ?key=value& |
| Author |
Rating:
Ted Cambron
|
| Title |
Test
Details
Url validation
|
| Expression |
(http|https)\:\/\/(([\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3})|([\w\-]+\.)+(((af|ax|al|dz|as|ad|ao|ai|aq|ag|am|aw|au|at|az|bs|bh|bd|bb|by|be|bz|bj|bm|bt|bo|ba|bw|bv|br|io|bn|bg|bf|kh|cm|ca|cv|ky|cf|td|cl|cn|cx|cc|km|cg|cd|ck|cr|ci|hr|cu|cy|cz|dk|dj|dm|do|ec|eg|sv|gq|er|ee|et|fk|fo|fj|fi|fr|gf|pf|tf|ga|gm|ge|de|gh|gi|gr|gl|gd|gp|gu|gt| gg|gn|gw|gy|ht|hm|va|hn|hk|hu|is|id|ir|iq|ie|im|il|it|jm|jp|je|jo|kz|ke|ki|kp|kr|kw|kg|la|lv|lb|ls|lr|ly|li|lt|lu|mo|mk|mg|mw|my|mv|ml|mt|mh|mq|mr|yt|mx|fm|md|mc|mn|ms|ma|mz|mm|nr|np|nl|an|nc|nz|ni|ng|nu|nf|mp|no|om|pk|pw|ps|pa|pg|py|pe|ph|pn|pl|pt|qa|re|ro|ru|rw|sh|kn|lc|pm|vc|ws|sm|st|sa|sn|cs|sc|sl|sg|sk|si|sb|so|za|gs|es|lk|sd|sr|sj|sz|se|ch|sy|tw|tj|tz|th|tl|tg|tk|to|tt|tn|tr|tm|tc|tv|ug|ua|gb|us|um|uy|uz|vu|ve|vn|vg|vi|wf|eh|ye|zm|zw|uk|com|edu|gov|int|mil|net|org|biz|info|name|pro|aero|coop|museum|arpa|co|in|ne|bi|na|pr|ae|mu|ar))))(:[\d]{1,4})?($|(\/([a-zA-Z0-9\.\?=/#%&\+-])*)*|\/) |
| Description |
An URL validation pattern with respect for TLD domains. It also validates ip urls, but it doesn't check for ip single parts range (1-255). It supports port specification. |
| Matches |
http://www.gianlucaesposito.it, http://www.gianluca.esposito.it, http://www.gianluca-esposito.it, http://www.gianlucaesposito.it/, http://www.gianlucaesposito.it/index.html, http://www.gianlucaesposito.it/index.php?id=1, http://www.gianlucaesposito.it:8080, http://www.gianlucaesposito.it:8080/, http://www.gianlucaesposito.it:8080/index.html, http://127.0.0.1, http://127.0.0.1:8080/, http://127.0.0.1:8080/index.html |
| Non-Matches |
http://www.gianlucaesposito.xx, http://www.gianluca-esposito.yy, http://www.gianluca.esposito.zzz |
| Author |
Rating:
Gianluca Esposito
|
| Title |
Test
Details
Linkify
|
| Expression |
\b(ht|f)tp[s]?://[^\s\n\r\t\<\>]+(?=[\b\s\n\r\t\<]) |
| Description |
This regex attempts to "linkify" a url that isn't already part of an <a> tag. |
| Matches |
http://regexlib.com |
| Non-Matches |
<a href="http://regexlib.com"> |
| Author |
Rating:
Erik Silkensen
|
| Title |
Test
Details
URL Validation
|
| Expression |
^((http|https|ftp|ftps)+(:\/\/))?(www\.)?
(([a-z0-9\.-]{2,})\.(ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|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|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|fx|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|me|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|rs|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|tl|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|aero|asia|cat|coop|edu|gov|jobs|mil|mobi|museum|tel|travel|pro|post|biz|com|info|int|name|net|org|pro|arpa)
|((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])))
(:([1-9][0-9]?[0-9]?[0-9]?|[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5]|))?
(((\/(([a-zA-Z0-9_\-\%\~\+\&\;]{1,})+)*)*)|\/$)?
(\.(php|html|htm|zip$|arj$|rar$|sit$|pdf$|gif$|jpg$|jpeg$|jpe$|tif$|tiff$))?
(\?([a-zA-Z0-9_\-]+\=[a-z-A-Z0-9_\-\%\~\+]+)?(\&([a-zA-Z0-9_\-]+\=[a-z-A-Z0-9_\-\%\~\+]+))*)?
(\=\?([a-zA-Z0-9_\-])*)?(((\+([a-zA-Z0-9_])*)?(\-([a-zA-Z0-9_])*)?)*)?
(\#([a-z-A-Z0-9_\-\%\~\+\&\;]*$))?$ |
| Description |
A regular expression which allows to find most of valid URL's and it is including some picture or packing-format prefixes at the end of an URL.
sorry but www.test.com.php is working too, maybe someone could give me a tip for a workaround. |
| Matches |
www.test.com|www.test.com#anker|http://www.test.info|242.240.12.24:65535|sub.test.6x.to/dir/file.php?test=test&test2=test2|www.mytest.com/sleep&search=?good+fine etc. |
| Non-Matches |
www.mytest.xxx|242.240.12.24:65536 |
| Author |
Rating:
Not yet rated.
Thomas Buettner
|
| Title |
Test
Details
URL
|
| Expression |
^(\w+)s?\:\/\/(\w+)?(\.)?(\w+)?\.(\w+)$ |
| Description |
http://www.url.com || http://url.com || http://first.url.com || https://www.url.com || https://url.com |
| Matches |
http://www.url.com | http://url.com | http://first.url.com | https://www.url.com | https://url.com |
| Non-Matches |
http://.com |
| Author |
Rating:
Kumar Deepak Ranjan
|
| Title |
Test
Details
URL v2
|
| Expression |
^(\w+)s?[:]\/\/(\w+)?[.]?(\w+)[.](\w+)$ |
| Description |
http://www.url.com || http://url.com || http://first.url.com || https://www.url.com || https://url.com |
| Matches |
http://www.url.com | http://url.com | http://first.url.com | https://www.url.com | https://url.com |
| Non-Matches |
http://.com |
| Author |
Rating:
Not yet rated.
Kumar Deepak Ranjan
|
| Title |
Test
Details
Domain URL
|
| Expression |
^(http\:\/\/(?:www\.)?[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*(?:\.[a-zA-Z0-9]+(?:(?:\-|_)[a-zA-Z0-9]+)*)*\.[a-zA-Z]{2,4}(?:\/)?)$ |
| Description |
A URL to a domain name. Only for http but that can be changed easily to accept more. the dashes and undescores can only be used between text and/or digits. The slash on the end is optional |
| Matches |
http://www.website.com/ | http://my-website.net | http://another_site.org |
| Non-Matches |
www.website.com | http://_website.com | http://www. web--site.com |
| Author |
Rating:
Ted Cambron
|
| Title |
Test
Details
URL Validation
|
| Expression |
^(ftp|https?):\/\/([^:]+:[^@]*@)?([a-zA-Z0-9][-_a-zA-Z0-9]*\.)*([a-zA-Z0-9][-_a-zA-Z0-9]*){1}(:[0-9]+)?\/?(((\/|\[|\]|-|~|_|\.|:|[a-zA-Z0-9]|%[0-9a-fA-F]{2})*)\?((\/|\[|\]|-|~|_|\.|,|:|=||\{|\}|[a-zA-Z0-9]|%[0-9a-fA-F]{2})*\&?)*)?(#([-_.a-zA-Z0-9]|%[a-fA-F0-9]{2})*)?$ |
| Description |
This pattern can be used to validate URLs starting with ftp, http or https |
| Matches |
https://user:password@subdomain.domain.tld:80/~user/a_1/b.2//c%203/file.extension?query=string&with=various¶m_eters&and=param,eters&with[]=brackets&and:colons&uniqid={21EC2020-3AEA-1069-A2DD-08002B30309D} |
| Non-Matches |
http://domain.....tld |
| Author |
Rating:
Rafael de la Torre Consuegra
|
| Title |
Test
Details
URl Domain names
|
| Expression |
^http[s]?://([a-zA-Z0-9\-]+\.)*([a-zA-Z]{3,61}|[a-zA-Z]{1,}\.[a-zA-Z]{2})/.*$ |
| Description |
Used for matching a URL and can be used for extracting the domain name from a given URL ending with '/'.
Concat $2 and $3 to get the domain name.
|
| Matches |
http://www.google.com/;http://google.com/;http://code.google.com/;http://google.co.uk/;http://tx.us/ |
| Non-Matches |
http://www.google.com; |
| Author |
Rating:
Not yet rated.
buzzooka
|
| Title |
Test
Details
Specific Top-Level Domain (TLD)
|
| Expression |
^.*(yourdomain.com).*$ |
| Description |
Matches the TLD of a given domain (replace yourdomain.com with whatever domain you're trying to enforce).
I was writing an web application in which I wanted to to display a special message to visitors if and only if they were referred to my site by one specific site. However, because the specific site in question was highly dynamic, referring URLs were all over the place in terms of consistency and the only thing I knew I could count on 100% was the TLD (subdomains and file paths acceptable, so long as the TLD matches exactly). |
| Matches |
yourdomain.com | http://www.yourdomain.com | http://subdomain.yourdomain.com/pages/manage/?act=4015876&ag=709254588456a |
| Non-Matches |
your-domain.com | ourdomain.com | yourdomain.co |
| Author |
Rating:
Matt Finazzo
|
| Title |
Test
Details
Simple URL
|
| Expression |
^(http(s?):\/\/)(www.)?(\w|-)+(\.(\w|-)+)*((\.[a-zA-Z]{2,3})|\.(aero|coop|info|museum|name))+(\/)?$ |
| Description |
Matches simple root website URLs.
Https and some new domains supported. |
| Matches |
http://www.google.com, http://www.google.co.uk, http://images.google.ie |
| Non-Matches |
www.google.com, http://www.google |
| Author |
Rating:
Francisco Grau
|
| Title |
Test
Details
Valid URL without protocol
|
| Expression |
^([\w-]+\.)+[\w-]+(/[\w-./?%&=]*)?$ |
| Description |
Use this expression to check that a valid web address is used without any protocol. |
| Matches |
www.myurl.com | myurl.com/default.aspx?i=id | www3.myurl.com/?a |
| Non-Matches |
www.my url.com | myurl.com/default.aspx?i=1 2 3 | www3.myurl.com?a | http://myurl.com |
| Author |
Rating:
Craig Palenshus
|
| 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:
Bob Clark
|
| Title |
Test
Details
Rapidshare.com Urls
|
| Expression |
/rapidshare\.com\/files\/(\d+)\/([^\'^\"^\s^>^<^\\^\/]+)/ |
| Description |
matches all rapidshare.com links /files / 8 numbers / filename |
| Matches |
http://rapidshare.com/files/61674290/somefile.rar | http://rapidshare.com/files/61674290/somefile2.rar | http://rapidshare.com/files/61674290/Shrek.The.Third_GG_SG_.part1.rar |
| Non-Matches |
-- |
| Author |
Rating:
Not yet rated.
Robert Pitt
|
| Title |
Test
Details
URL Parsing
|
| Expression |
(?:(?<scheme>[a-zA-Z]+)://)?(?<domain>(?:[0-9a-zA-Z\-_]+(?:[.][0-9a-zA-Z\-_]+)*))(?::(?<port>[0-9]+))?(?<path>(?:/[0-9a-zA-Z\-_.]+)+)(?:[?](?<query>.+))? |
| Description |
Separates a URL into components viz. schema, domain, port, path and query. Avoids unnecessary numbered groups caused by braces. |
| Matches |
http://www.google.com/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | ftp://ftp.google.com:21/Files/Data.zip | http://www.google.com:80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= |
| Non-Matches |
http:/www.google.co.za:80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | http://www.google.co.za?80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | http://www.google.co.za:80/cgi/search/hl=en&q=RegEx+Library&btnG=Google+Search&meta= |
| Author |
Rating:
Not yet rated.
Raje
|
| Title |
Test
Details
Parse linked url
|
| Expression |
((?<html>(href|src)\s*=\s*")|(?<css>url\())(?<url>.*?)(?(html)"|\)) |
| Description |
Given HTMl or CSS source, find the value of all href and src attributes + anything between url(). |
| Matches |
href="foo"|scr="foo"|url(foo) |
| Non-Matches |
href(foo)|src(foo)|url="foo" |
| Author |
Rating:
Tinminator
|
| Title |
Test
Details
Anchor Href Link URL
|
| Expression |
href=(?<QUOTE>[\""\'])?(?<URL>(?<SCHEME>(file|ftp|http|https|news|nntp):\/\/|mailto\:)?(?<EMAIL>[\w-]+@)?(?<HOST>(?(SCHEME)[\w]+(\.[\w-]+)*?))(?<PATH>\/?\w*[\w-%\:\.\+\/]+)?(?<QUERY>\?[\w-%\+:\.]*(=[\w-%\+:\.]*)?(&[\w-%\+\:\.]*(=[\w-%\+:\.]*)?)*)?(?<ANCHOR>\#[\w-%\+:\.]+)?)(?<-QUOTE>[\""\'])?(?#VALIDATE QUOTES/URL)(?(PATH)|(?(SCHEME)|(?!)))(?(QUOTE)(?!)) |
| Description |
Matches href links / URLS within html and separates out the Scheme, Email, Domain, Path, Query, Anchor and the full URL. Based on Andrew Lee's version with some further tweaking. |
| Matches |
href="mailto:text@example.com" | href="www.example.com" | href="https://localhost/bla-h3/?x%20#test1" | href='eek' | href="ftp://127.0.0.1/" | href="http://example.com/Search.aspx?k=href&c=-1&m=-1&ps=%20" | href=example.com | href="http://www.example.com/search?q=pi+day&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#sx" |
| Non-Matches |
href="" | href= | href="javascript: testMe();" | href="bad example" |
| Author |
Rating:
Eric Bouwsema
|
| Title |
Test
Details
URI Validation
|
| Expression |
if(!isValidURL($_POST['url']){ echo "do something"; } |
| Description |
function isValidURL($url) {
$protocol = "((http|ftp|https):\/\/)?";
$domain = "([[:alpha:]][-[:alnum:]]*[[:alnum:]])(\.[[:alpha:]][-[:alnum:]]*[[:alpha:]])+";
$dir = "(/[[:alpha:]][-[:alnum:]]*[[:alnum:]])*";
$page = "(/[[:alpha:]][-[:alnum:]]*\.[[:alpha:]]{3,5})?";
$getstring = "(\?([[:alnum:]][-_%[:alnum:]]*=[-_%[:alnum:]]+)(&([[:alnum:]][-_%[:alnum:]]*=[-_%[:alnum:]]+))*)?";
$pattern = "^".$protocol.$domain.$dir.$page.$getstring."$";
return eregi($pattern, $url);
}
//-----------------
Be sure to put each variable ($protocol, $domain, $dir, $page, $getstring, $pattern, and 'return') on separate line! |
| Matches |
www.google.co.uk | www9.g-88gle.co.uk | http://path1/to-page | http://phpinfo.php |
| Non-Matches |
9ww.google.3o.uk | www.google4.co.uk3 | http://path1-/2-page | http://phpinfo.php4 |
| Author |
Rating:
Ardjuna Pandu
|
Displaying page
of
pages;
Items to