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 1 of 4 pages; Items 1 to 20
Title Test Details Pattern Title
Expression
^(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$
Description
Regular expression for validating a decimal IP address. Matches 4 groups of from 1 to 3 digits, where each group of digits ranges from 0 to 255 in value. Groups of digits must be separated by a single period (.) with no other formatting characters present. Uses conditional regex with lookahead syntax to prevent a match on a period following the final group of digits.
Matches
217.6.9.89 | 0.0.0.0 | 255.255.255.255
Non-Matches
256.0.0.0 | 0127.3 | 217.6.9.89.
Author Rating: The rating for this expression. Jerry Schmersahl
Title Test Details Pattern Title
Expression
^((?:2[0-5]{2}|1\d{2}|[1-9]\d|[1-9])\.(?:(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)\.){2}(?:2[0-5]{2}|1\d{2}|[1-9]\d|\d)):(\d|[1-9]\d|[1-9]\d{2,3}|[1-5]\d{4}|6[0-4]\d{3}|654\d{2}|655[0-2]\d|6553[0-5])$
Description
IPv4 ip:port checker, I hope it will help you. $1 - IP, $2 - port. More to come, maybe :)
Matches
127.0.0.1:80 | 255.255.255.0:21 | 1.0.0.0:1
Non-Matches
0.0.0.0:1 | 256.1.1.1:20 | 127.0.0.1:65536
Author Rating: The rating for this expression. Brano Gerzo
Title Test Details Pattern Title
Expression
^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$
Description
Checks domain names. This validates domains based on latest specifications (RFCs 952 and 1123 dealing with hostnames and RFC 1035 dealing with domain name system requirements) except that it only includes realistic fully-qualified domains: 1. requires at least one subdomain 2. allows shortest top-level domains like "ca", and "museum" as longest. Other validation rules: 1. Labels/parts should be seperated by period. 2. Each label/part has maximum of 63 characters. 3. First and last character of label must be alphanumeric, other characters alphanumeric or hyphen. 4. Does not check maxlength of domain which incidentally is 253 characters of text (255 binary representation). For a regular expression that matches ALL domains: ^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)*[a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?$
Matches
regexlib.com | this.is.a.museum | 3com.com
Non-Matches
notadomain-.com | helloworld.c | .oops.org
Author Rating: The rating for this expression. Remi Sabourin
Title Test Details Pattern Title
Expression
^[^\\\/\?\*\"\'\>\<\:\|]*$
Description
Validation of a Folder Name. Excludes all forbidden characters
Matches
321321321 dasds
Non-Matches
/\3fsdfsd
Author Rating: The rating for this expression. Nikolay Yordanov
Title Test Details Pattern Title
Expression
^([a-zA-Z]\:|\\\\[^\/\\:*?"<>|]+\\[^\/\\:*?"<>|]+)(\\[^\/\\:*?"<>|]+)+(\.[^\/\\:*?"<>|]+)$
Description
This regular expression match any valid file path. It checks local drives and network path. The file extension is required.
Matches
c:\Test.txt | \\server\shared\Test.txt | \\server\shared\Test.t
Non-Matches
c:\Test | \\server\shared | \\server\shared\Test.?
Author Rating: The rating for this expression. Roberto Misticoni
Title Test Details Pattern Title
Expression
^(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])$
Description
RegExp for validating the format of IP Addresses. This works great with the ASP.NET RegularExpressionValidator server control.
Matches
127.0.0.1 | 255.255.255.0 | 192.168.0.1
Non-Matches
1200.5.4.3 | abc.def.ghi.jkl | 255.foo.bar.1
Author Rating: The rating for this expression. G. Andrew Duthie
Title Test Details Pattern Title
Expression
^((https?|ftp)\://((\[?(\d{1,3}\.){3}\d{1,3}\]?)|(([-a-zA-Z0-9]+\.)+[a-zA-Z]{2,4}))(\:\d+)?(/[-a-zA-Z0-9._?,'+&amp;%$#=~\\]+)*/?)$
Description
Using other regular experssions from this page, combining others for email addresses, and mixing in my own ideas - I came up with this regular expression. Can be used to validate input into a database.
Matches
http://207.68.172.254/home.ashx | ftp://ftp.netscape.com/ | https://www.brinkster.com/login.asp
Non-Matches
htp://mistake.com/ | http://www_address.com/ | ftp://www.files.com/file with spaces.txt
Author Rating: The rating for this expression. Benjamin Gray
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 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
^(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
(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?
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 &quot;check out http://www.yahoo.com/.&quot; (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 All existing TLDs (Top-Level Domains) according to IANA specifications
Expression
(a(?:[cdefgilmnoqrstuwxz]|ero|(?:rp|si)a)|b(?:[abdefghijmnorstvwyz]iz)|c(?:[acdfghiklmnoruvxyz]|at|o(?:m|op))|d[ejkmoz]|e(?:[ceghrstu]|du)|f[ijkmor]|g(?:[abdefghilmnpqrstuwy]|ov)|h[kmnrtu]|i(?:[delmnoqrst]|n(?:fo|t))|j(?:[emop]|obs)|k[eghimnprwyz]|l[abcikrstuvy]|m(?:[acdeghklmnopqrstuvwxyz]|il|obi|useum)|n(?:[acefgilopruz]|ame|et)|o(?:m|rg)|p(?:[aefghklmnrstwy]|ro)|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|t(?:[cdfghjklmnoprtvwz]|(?:rav)?el)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw])
Description
This regexp matches all existing TLDs (Top-Level Domains) according to IANA specifications as of 14/07/2007.
Matches
all ccTLDs (Country-Code Top-Level Domains) | all gTLDs (Generic Top-Level Domains) | .arpa
Non-Matches
n.o.n - e.x.i.s.t.i.n.g T.L.D.s
Author Rating: The rating for this expression. Daniel Beck
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
(?!\.)[a-z]{1,4}$
Description
Matches files extension
Matches
file.jpg | file.c | file.gif
Non-Matches
file.34
Author Rating: The rating for this expression. Carlos R. L. Rodrigues
Title Test Details Pattern Title
Expression
^([a-zA-Z]\:) (\\{1}| ((\\{1}) [^\\] ([^/:*?&lt;&gt;&quot;|]*(?&lt;![ ])))+)$
Description
Validates windows path and invalidates UNC path
Matches
c:\34\445\546\3.htm | C:\
Non-Matches
\\qaz | c:\Ram&lt;\ | C: or c:\\ or \\
Author Rating: The rating for this expression. Gaurav Shrivastava
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\.\,\;\?\'\\\+&amp;%\$#\=~_\-]+))*$
Description
Version 1.3.0: I needed a regexp to validate URL's without the ht(f)tp(s):// and include North American domains (like .us and .ca) and there didn't seem to be one available...so I created one. It will also work with ASP QueryStrings and anchor URL's. If you have a problem with the expression or have any suggestions to improve, please write me and let me know. Added .uk domain and expression now allows for URLs that contain JSP session IDs. 4/14/04 - added ability to include URLs that start with server names.
Matches
www.blah.com:8103 | www.blah.com/blah.asp?sort=ASC | www.blah.com/blah.htm#blah
Non-Matches
www.state.ga | http://www.blah.ru
Author Rating: The rating for this expression. Brad Dobyns
Title Test Details Pattern Title
Expression
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w ]*.*))+\.(jpg|JPG)$
Description
It matches .jpg files. It allows for a dot in the path. A dot may occur in such directories as: C:\Documents and Settings\roman.lukyanenko\Desktop\stuff\b_card2.jpg or C:\Windows\Microsoft.NET etc
Matches
C:\Documents and Settings\roman.lukyanenko\Desktop\stuff\b_card2.jpg | C:\b_card.jpg | \\network\fol
Non-Matches
C:\file.xls
Author Rating: The rating for this expression. Roman Lukyanenko
Title Test Details Pattern Title
Expression
^\\{2}[\w-]+\\(([\w-][\w-\s]*[\w-]+[$$]?$)|([\w-][$$]?$))
Description
Validates a UNC to conform to \\server\service Must have a &quot;\\&quot; at the start Server may contain alpha/numeric/underscore/dash, Followed by another single &quot;\&quot; Service may contain alpha/numeric/underscore/dash/$/space Note: Service may not start nor end with a space Service may only contain one $, and only at the end No additional &quot;\&quot; may follow afterwards
Matches
\\server\service | \\server\my service | \\serv_001\service$
Non-Matches
\\my server\service | \\server\ service | \\server$\service
Author Rating: The rating for this expression. Paul Haines
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
\A([A-Za-z0-9'~`!@#$%&amp;^_+=\(\){},\-\[\]\;])+?([ A-Za-z0-9'~` !@#$%&amp;^_+=\(\){},\-\[\];]|([.]))*?(?(3)(([ A-Za-z0-9'~`!@#$ %&amp;^_+=\(\){},\-\[\]\;]*?)([A-Za-z0-9'~`!@#$%&amp;^_+=\(\){},\-\[ \];])+\z)|(\z))
Description
Used to match windows filenames. Fails if there is leading or trailing spaces. Fails if the input contains /\:*?&quot;&lt;&gt;| . Fails if the input begins or ends with '.'
Matches
Test.txt | T est.txt | Rosco's.Test.txt
Non-Matches
\Folder\Test.txt | T*est.txt | Test.
Author Rating: The rating for this expression. Rosco Pikotrain
Change page:   |    Displaying page 1 of 4 pages; Items 1 to 20

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