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

Please support RegExLib Sponsors

Sponsors

Browse Expressions by Category

74 regular expressions found in this category!

Expressions in category: Uri

Change page:   |    Displaying page 3 of 4 pages; Items 41 to 60
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: Not yet rated. Martin Matusiak
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 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: Not yet rated. Michael Krutwig
Title Test Details Pattern Title
Expression
([a-zA-Z]:(\\w+)*\\[a-zA-Z0_9]+)?.xls
Description
This RegEx will help to validate a physical file path with a specific file extension (here xls)
Matches
E:\DyAGT\SD01A_specV2.xls
Non-Matches
E:\DyAGT\SD01A_specV2.txt
Author Rating: Not yet rated. vinod kumar
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
^([a-zA-Z]\:|\\)\\([^\\]+\\)*[^\/:*?"<>|]+\.htm(l)?$
Description
Validates a file path on your local drive or a network drive. A similar one was written by Vinod Kumar but it does not reject asterisks in the path. Moreover, his did not work with RegularExpressionValidators. This one does.
Matches
x:\test\testing.htm | x:\test\test#$ ing.html | \\test\testing.html
Non-Matches
x:\test\test/ing.htm | x:\test\test*.htm | \\test?&lt;.htm
Author Rating: Not yet rated. asdf asdfa
Title Test Details Pattern Title
Expression
\[link="(?<link>((.|\n)*?))"\](?<text>((.|\n)*?))\[\/link\]
Description
This can be used in conjunction with the replace method to provide pseudo-code support without having to enable HTML. The replacement string (in ASP.NET, use RegExp.Replace(SourceString, RegularExpressionPattern, ReplacementString) is &lt;a href=&quot;${link}&quot;&gt;${text}&lt;/a&gt;.
Matches
[link="http://www.yahoo.com"]Yahoo[/link]
Non-Matches
[link]http://www.yahoo.com[/link] | [link=http://www.yahoo.com]Yahoo[/link]
Author Rating: Not yet rated. Ryan S
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
\.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
^(http|https|ftp)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&amp;%\$\-]+)*@)?((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.[a-zA-Z]{2,4})(\:[0-9]+)?(/[^/][a-zA-Z0-9\.\,\?\'\\/\+&amp;%\$#\=~_\-@]*)*$
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:[email protected]:123
Non-Matches
sysrage.net
Author Rating: Not yet rated. Brian Bothwell
Title Test Details Pattern Title
Expression
^DOMAIN\\\w+$
Description
In response to a question on the regex list at www.aspadvice.com, this expression should ensure that a login field's username includes a 'DOMAIN\' prefix. The latter part of the expression should probably be limited so that it only allows usernames of appropriate lengths, perhaps 3 to 20 characters (by replacing + with {3,20} for instance).
Matches
DOMAIN\ssmith | DOMAIN\a | DOMAIN\username
Non-Matches
ssmith | username | DOMAIN\
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
[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 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
wsrp_rewrite\?(?&lt;wsrp_uri&gt;[\w%:&amp;\\/;.]*)/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 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
^([a-zA-Z].*|[1-9].*)\.(((j|J)(p|P)(g|G))|((g|G)(i|I)(f|F)))$
Description
Regular expression to limit types of files accepted. This example matches .jpg and .gif files only.
Matches
filename.jpg | FileName.JPG | filename.gif
Non-Matches
filename.png | filename.xxx | filename.bmp
Author Rating: Not yet rated. Ramon Hildreth
Title Test Details Pattern Title
Expression
^((\d|\d\d|[0-1]\d\d|2[0-4]\d|25[0-5])\.(\d|\d\d|[0-1]\d\d|2[0-4]\d|25[0-5])\.(\d|\d\d|[0-1]\d\d|2[0-4]\d|25[0-5])\.(\d|\d\d|[0-1]\d\d|2[0-4]\d|25[0-5]))$
Description
Matches valids TCP/IP-Adresses
Matches
1.198.0.1 | 100.10.0.1 | 200.200.123.123
Non-Matches
..12.23 | a.23.345 | 400.500.300.300
Author Rating: Not yet rated. Karsten Sosna
Title Test Details Pattern Title
Expression
^[a-z]+([a-z0-9-]*[a-z0-9]+)?(\.([a-z]+([a-z0-9-]*[a-z0-9]+)?)+)*$
Description
A simple regex which should validate a domain name according to RFC 1035 updated to match domain names with hyphens
Matches
www.domain.com | w123.d42omain.c43om | ww-w.d-omain.com
Non-Matches
1www.domain.com | www.1domain.com | www.domain.com-
Author Rating: Not yet rated. Tinus Norstved
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
Change page:   |    Displaying page 3 of 4 pages; Items 41 to 60

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