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

Please support RegExLib Sponsors

Sponsors

Advanced Search

Keywords

Category

Minimum Rating

Results per Page

Search Results: 17 regular expressions found.

   Displaying page 1 of 1 pages; Items 1 to 17
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: The rating for this expression. 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=&quot;http&quot;, authority=&quot;regexlib.com&quot;, path=&quot;/REDetails.aspx&quot;, query=&quot;regexp_id=x&quot; and fragment=&quot;Details&quot;. 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
^(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
^(http|https|ftp)\://(((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])|([a-zA-Z0-9_\-\.])+\.(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|uk|me))((:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&amp;%\$#\=~])*)$
Description
First attempt at reg ex - work in progress - can't quite get it to work absolutely correctly so any comments would be great. Matches everything as it should apart from the last part of the IP, i.e. allows http://255.255.255.999 (which obviously it shouldn't but ran out of inspiration) so any corrections humbly and gratefully accepted. TLD check is not complete - just added most of the major ones but easy to dd to if you want to. BTW - you'll need to replace the &amp; with just the ampersand in the reg ex
Matches
http://www.allkins.com | http://255.255.255.255 | http://allkins.com/page.asp?action=1
Non-Matches
http://test.testing
Author Rating: Not yet rated. Dominic Allkins
Title Test Details Pattern Title
Expression
(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): &lt;a href=&quot;\\1\\3\\4&quot; target=&quot;_blank&quot;&gt;\\3\\6&lt;/a&gt;
Matches
http://www.domain.com | http://www.domain.com/index%20page.htm #linktext# | mailto://user@domai
Non-Matches
&lt;a href=&quot;http://www.domain.com&quot;&gt;real html link&lt;/a&gt; | 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: Not yet rated. 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: Not yet rated. 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: The rating for this expression. Manpreet Grewal
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 &quot;/&quot; at the end. http://www.domain.com/folder/
Matches
https://192.168.0.2:80/users/~fname.lname/file.ext | ftp://user1:[email protected] | http://www.dom
Non-Matches
www.domain.com | user1:[email protected] | 192.168.0.2/folder/file.ext
Author Rating: The rating for this expression. Ariel Merrell
Title Test Details UK Domain Names with Protocol
Expression
^(ht|f)tp((?<=http)s)?://((?<=http://)www|(?<=https://)www|(?<=ftp://)ftp)\.(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk$
Description
UK domains with protocol for http/https/ftp. Based on my previous expression, this allows the subdomain &quot;www&quot; for the http/https protocols, or &quot;ftp&quot; for the ftp protocol only.
Matches
http://www.zeropanic.co.uk | ftp://ftp.sunsite.ac.uk | https://www.z2.co.uk
Non-Matches
gopher://www.z2.co.uk | http://ftp.z2.co.uk | ftp://www.z2.co.uk
Author Rating: Not yet rated. Amos Hurd
Title Test Details Pattern Title
Expression
(\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 : &lt;br&gt;http://www.acme.com), the url must either start with a \s, \n or any character other than &gt;. 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 =&quot;(\s|\n|^)(\w+://[^\s\n]+)&quot; strResult = re.Replace(strText, &quot;$1&lt;a href='$2' target='_new'&gt;$2&lt;/a&gt;&quot;)
Matches
http://www.acme.com | ftp://ftp.acme.com/hede | gopher://asdfasd.asdfasdf
Non-Matches
&lt;a href=&quot;http://acme.com&quot;&gt;http://www.acme.com&lt;/a&gt; | &lt;br&gt;http://www.acme.
Author Rating: The rating for this expression. 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\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$
Description
Cheap and cheerful URL checker. Requires a http/https/ftp at the start and will then allow anything starting with at least a &lt;something&gt;.&lt;something&gt;.&lt;something&gt; 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: The rating for this expression. John Main
Title Test Details UK Domain Names with Protocol and Port
Expression
^(ht|f)tp((?<=http)s)?://((?<=http://)www|(?<=https://)www|(?<=ftp://)ftp)\.(([a-z][0-9])|([0-9][a-z])|([a-z0-9][a-z0-9\-]{1,2}[a-z0-9])|([a-z0-9][a-z0-9\-](([a-z0-9\-][a-z0-9])|([a-z0-9][a-z0-9\-]))[a-z0-9\-]*[a-z0-9]))\.(co|me|org|ltd|plc|net|sch|ac|mod|nhs|police|gov)\.uk(:\d+)?\/?$
Description
UK http/https/ftp URI. Based on my previous expression, this one takes an optional port number and optional trailing slash.
Matches
http://www.zeropanic.co.uk/ | http://www.zeropanic.co.uk:81/ | http://www.zeropanic.co.uk:81
Non-Matches
http://www.zeropanic.com:81/
Author Rating: Not yet rated. Amos Hurd
Title Test Details Pattern Title
Expression
^(?<link>((?<prot>http:\/\/)*(?<subdomain>(www|[^\-\n]*)*)(\.)*(?<domain>[^\-\n]+)\.(?<after>[a-zA-Z]{2,3}[^>\n]*)))$
Description
I wrote this after I couldn't find an expression that would search for valid URLs, whether they had HTTP in front or not. This will find those that don't have hyphens anywhere in them (except for after the domain).
Matches
http://www.google.com | www.123google.com | www.google.com/help/me
Non-Matches
-123google.com | http://-123.123google.com
Author Rating: Not yet rated. Joe Pontani
Title Test Details Pattern Title
Expression
^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$
Description
Matches full and compressed IPv6 addresses as defined in RFC 2373 (http://www.faqs.org/rfcs/rfc2373.html). No useful captures. Various implementations require different terminators. (i.e. ^-$ or \b-\b)
Matches
FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 | 1080::8:800:200C:417A | ::FFFF:129.144.52.38
Non-Matches
FEDC::7654:3210::BA98:7654:3210 | FEDC:BA98:7654:3210 | ::
Author Rating: The rating for this expression. Jeff Johnston
Title Test Details Pattern Title
Expression
((http\://|https\://|ftp\://)|(www.))+(([a-zA-Z0-9\.-]+\.[a-zA-Z]{2,4})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9%:/-_\?\.'~]*)?
Description
This RE matches the web links which begin http://, ftp://, https:// or www. You can edit this disadvantage easy...
Matches
www.diskusneforum.sk | http://diskusneforum.sk | ftp://23.45.267.189/
Non-Matches
diskusneforum.sk | localhost
Author Rating: Not yet rated. Martin Ille
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
   Displaying page 1 of 1 pages; Items 1 to 17

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