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: 204 regular expressions found.

Change page:   |    Displaying page 2 of 11 pages; Items 21 to 40
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 &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 Pattern Title
Expression
[a-zA-Z]{3,}://[a-zA-Z0-9\.]+/*[a-zA-Z0-9/\\%_.]*\?*[a-zA-Z0-9/\\%_.=&amp;]*
Description
A simple url search pattern that works against the most generic cases. A little better in terms of matches than the other URL expressions listed.
Matches
http://someserver | http://www.someserver.com/ | http://www.someserver.com/somefile.txt
Non-Matches
Thin | Lizzy
Author Rating: Not yet rated. Gerrard Lindsay
Title Test Details 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 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\.\,\;\?\'\\\+&amp;%\$#\=~_\-]+))*$
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: The rating for this expression. 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: The rating for this expression. 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: The rating for this expression. Ryan Jones
Title Test Details Pattern Title
Expression
&lt;\s*a\s[^&gt;]*\bhref\s*=\s* ('(?&lt;url&gt;[^']*)'|&quot;&quot;(?&lt;url&gt;[^&quot;&quot;]*)&quot;&quot;|(?&lt;url&gt;\S*))[^&gt;]*&gt; (?&lt;body&gt;(.|\s)*?)&lt;\s*/a\s*&gt;
Description
Suitable for extraction of all hyperlinks in the format: &lt;a ... href=&quot;...&quot; ...&gt; some text &lt;/a&gt; from a text document. Separates in groups the components of the links (url and body).
Matches
&lt;a href=&quot;javascript:'window.close()'&quot;&gt;close the window&lt;/a&gt; | &lt;a target=&quo
Non-Matches
&lt;aa href=&quot;test.htm&quot;&gt;test&lt;/a&gt; | &lt; a href hr = 'http://www.nakov.com'&gt;...&
Author Rating: The rating for this expression. 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: Not yet rated. 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})\/)([^ \[\]\(\),;&quot;'&lt;&gt;\n\r\t]+)([^\. \[\]\(\),;&quot;'&lt;&gt;\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: The rating for this expression. James Johnston
Title Test Details Pattern Title
Expression
href\s*=\s*(?:(?:\&quot;(?&lt;url&gt;[^\&quot;]*)\&quot;)|(?&lt;url&gt;[^\s*] ))&gt;(?&lt;title&gt;[^&lt;]+)&lt;/\w&gt;
Description
finds the url and url description for all links in a given text.
Matches
&lt;td bgcolor=&quot;#ffffff&quot; class=&quot;small&quot;&gt;&amp;nbsp;&lt;A HREF=&quot; http://
Non-Matches
&lt;td bgcolor=&quot;#ffffff&quot; class=&quot;small&quot;&gt;&amp;nbsp;&lt;A HREF http://www.thepla
Author Rating: Not yet rated. 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\.\/\%\+\-\=\&amp;\?\:\\\&quot;\'\,\|\~\;]*)\b
Description
Url matching
Matches
http://210.50.2.215/sd_new/WebBuilder.cgi?RegID=7449046&amp;First=Ok&amp;Upt=Ok&amp;EditPage=3&amp;S
Non-Matches
Hmmmm
Author Rating: The rating for this expression. 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\-\._\?\,\'/\\\+&amp;%\$#\=~]*)?$
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: The rating for this expression. 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&amp;param2=5&amp;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&param2=2&param3=5&param4=9
Non-Matches
none
Author Rating: Not yet rated. 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\&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
^[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: Not yet rated. 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: Not yet rated. Dean Dal Bozzo
Change page:   |    Displaying page 2 of 11 pages; Items 21 to 40

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