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 IPv6 addresses including compressed and IPv4-embedded variants (RFC 2373)
Expression
(::|(([a-fA-F0-9]{1,4}):){7}(([a-fA-F0-9]{1,4}))|(:(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){1,6}:)|((([a-fA-F0-9]{1,4}):)(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){2}(:([a-fA-F0-9]{1,4})){1,5})|((([a-fA-F0-9]{1,4}):){3}(:([a-fA-F0-9]{1,4})){1,4})|((([a-fA-F0-9]{1,4}):){4}(:([a-fA-F0-9]{1,4})){1,3})|((([a-fA-F0-9]{1,4}):){5}(:([a-fA-F0-9]{1,4})){1,2}))
Description
This RE recognizes IPv6 addresses for all the representations described by RFC 2373: 1) extended format (with both upper and lowercase HEX) 2) compressed format (eg 2001::6:a) 3) IPv4-embedded format (eg ::ffff:1.2.3.4) limited to addresses of the traditional dual-stack configuration Resulting from observation of real-world implementations, case 2) is extended to allow "::" for one 0-group alone. Although the RFC is clear on "::" being for "multiple groups of 16-bits of zeros" only, some tools like "dig" for the mac produce those values. The RE is simple and quite elegant; it has been tested on over 300 IPv6 addresses collected by dig-ing IPv6-enabled domains; it is used in sshguard's log parser, see http://www.sshguard.net .
Matches
2001:470:b0b4:1:280:c6ff:fef2:9410 | 2001:868:100::3 | 2001:888:144a::a441:888:1002 | ::1 | a:b:: | ::FFFF:1.2.3.4
Non-Matches
1:2:3:4:5:6:7:8:9 | a::b::c | x:x:x:x:x:x:x:x
Author Rating: Not yet rated. mij
Title Test Details IPv6 address
Expression
^([0-9a-fA-F]{4}|0)(\:([0-9a-fA-F]{4}|0)){7}$
Description
IPv6 address (128 bit). Matches hexadecimal patterns and single 0 in the address.
Matches
3e4f:123f:c12a:5566:888e:9975:aaff:2344 | 3e4f:123f:c12a:0:0:0:0:2344 | 0000:0000:0000:0000:0000:000
Non-Matches
3e4f:123f:c12a:5566:888e:9975:aafg:2344 | 3e4f:123f:c12a:0:0:0:1:2344 | 0000:0000:0000:0000:0000:000
Author Rating: Not yet rated. Dean Dal Bozzo
Title Test Details IPv6
Expression
^([0-9a-f]{0,4}:){2,7}(:|[0-9a-f]{1,4})$
Description
Matches compressed and uncompressed IPv6.
Matches
2001:db8:abc:1400:: | :: | 0000::
Non-Matches
: | 0000: | 5678::
Author Rating: Not yet rated. Peter Kahl
Title Test Details URI checker
Expression
#^([a-z0-9+\-.]+):([/]{0,2}([a-z0-9\-._~%!\$&'\(\)\*+,;=:]+@)?([\[\]a-z0-9\-._~%!\$&'\(\)\*+,;=:]+(:[0-9]+)?))([a-z0-9\-._~%!\$&'\(\)\*+,;=:@/]*)(\?[\?/a-z0-9\-._~%!\$&'\(\)\*+,;=:@]+)?(\#[a-z0-9\-._~%!\$&'\(\)\*+,;=:@/\?]+)?#i
Description
This is a Perl regular expression which matches any valid URI. I've extensively tested it (with the help of Wikipedia, and the actual URI specification written by Sir Tim Burners Lee himself), and it seems to work in all cases. Whether it will actually work to validate a URI is questionable... But any URI that is valid, will match. Including those with IPv6 addresses.
Matches
ftp://ftp.is.co.za/rfc/rfc1808.txt | http://www.ietf.org/rfc/rfc2396.txt | ldap://[2001:db8::7]/c=GB?objectClass?one | mailto:[email protected] | news:comp.infosystems.www.servers.unix | tel:+1-816-555-1212 | telnet://192.0.2.16:80/ | urn:oasis:names:specification:docbook:dtd:xml:4.1.2
Non-Matches
asdf?fdjdf:blah | dskjf:///////blah | google.com
Author Rating: The rating for this expression. Colin Griffith
Title Test Details Basic Email Validation
Expression
^([a-z0-9]+[.+-])*([a-z0-9]+)+@(([a-z0-9]+[.-])+([a-z]{2,})$|(([0-9]|[1-9][0-9]|1[0-9]{1,2}|2[0-4][0-9]|25[0-5])(\.|$)){4})
Description
Validates most common varieties of email addresses. Will accept domain with character-valid TLD, and also will accept an IPv4 address. It doesn't support validation of IPv6 address. Will also accept a valid username with tags.
Matches
Non-Matches
Author Rating: Not yet rated. Slavik Meltser
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
^((([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
^([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}$
Description
IPv6 text representation of addresses without compression from RFC 1884. This regular expression doesn't allow IPv6 compression ("::") or mixed IPv4 addresses.
Matches
FEDC:BA98:7654:3210:FEDC:BA98:7654:3210 | 1080:0:0:0:8:800:200C:417A | 0:0:0:0:0:0:0:1
Non-Matches
128.0.0.1 | FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:AA31 | ::1
Author Rating: Not yet rated. Mikko Puonti
Title Test Details email address (RFC 2822 mailbox)
Expression
^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$
Description
This accepts RFC 2822 email addresses in the form:<br> [email protected] OR<br> Blah &lt;[email protected]&gt;<br> <br> RFC 2822 email 'mailbox':<br> mailbox = name-addr | addr-spec<br> name-addr = [display-name] "<" addr-spec ">"<br> addr-spec = local-part "@" domain<br> domain = rfc2821domain | rfc2821domain-literal<br> <br> local-part conforms to RFC 2822.<br> <br> domain is either:<br> An rfc 2821 domain (EXCEPT that the final sub-domain must consist of 2 or more letters only).<br> OR<br> An rfc 2821 address-literal.<br> (Note, no attempt is made to fully validate an IPv6 address-literal.)<br> <br> Notes:<br> This pattern uses (.NET/Perl only?) features named group "(?&lt;name&gt;)" and alternation/IF (?(name)).<br> <br> See <a href="http://regexadvice.com/forums/permalink/26742/26742/ShowThread.aspx#26742">this regexadvice.com thread</a> for more info, including a version that does not use .NET features.<br> <br> RFC 2822 (and 822) do allow embedded comments, whitespace, and newlines within *some* parts of an email address, but this pattern above DOES NOT.<br> <br> RFC 2822 (and 822) allow the domain to be a simple domain with NO ".", but this pattern requires a compound domain at least one "." in the domain name, as per RFC 2821 (4.1.2).<br> <br> RFC 2822 allows/disallows certain whitespace characters in parts of an email address, such as TAB, CR, LF BUT the pattern above does NOT test for these, and assumes that they are not present in the string (on the basis that these characters are hard to enter into an edit box).
Matches
[email protected] | Name Surname <[email protected]> | "b. blah"@blah.co.nz
Non-Matches
name [email protected] | name."surname"@blah.com | [email protected]
Author Rating: The rating for this expression. Mark Cranness
Title Test Details IPV4 and IPV6 address
Expression
^(((([1]?\d)?\d|2[0-4]\d|25[0-5])\.){3}(([1]?\d)?\d|2[0-4]\d|25[0-5]))|([\da-fA-F]{1,4}(\:[\da-fA-F]{1,4}){7})|(([\da-fA-F]{1,4}:){0,5}::([\da-fA-F]{1,4}:){0,5}[\da-fA-F]{1,4})$
Description
IPV4 and IPV6 address
Matches
10.11.12.13 | ::1 | fe80::2d3d:3489:63e3:35eb
Non-Matches
3.2.1 | 1::1::1 | 1:2:3:4:5:6:7:8:9
Author Rating: The rating for this expression. bxliu
Title Test Details IPv6 addresses (RFC 4291)
Expression
/^(((?=.*(::))(?!.*\3.+\3))\3?|([\dA-F]{1,4}(\3|:\b|$)|\2))(?4){5}((?4){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})\z/i
Description
This regex matches all (14.095.120.151.883.281.746.489.830.170.974.347.714.655.937) valid IPv6 address _representations_ as described by RFC 4291. Current regex is valid for PCRE only, for Perl/Java/Ruby/Phython/.NET/ECMA(JavaScript)/XML specific regex visit http://home.deds.nl/~aeron/regex/
Matches
1:2:3:4:5:6:7:8 | 1:2:3:4:5:6:1.2.3.4 | 1::8 | 1::1.2.3.4 | :: | ::1.2.3.4 | 0000:000:00:0::0.0.0.0
Non-Matches
::01.02.03.04 | ::001.002.003.004 | ::011.022.033.044
Author Rating: The rating for this expression. Aeron
Title Test Details IPV4 and IPV6 address
Expression
([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(\d{1,3}\.){3}\d{1,3}
Description
Matches all IPV6 and IPV4 addresses. Doesn't limit IPV4 to just values of 255. Doesn't allow IPV6 compression.
Matches
0:123:af00:ffff:0C67:0:0:8787 | 0:0:0:0:0:0:0:1 | 0.0.0.1 | 999.999.999.999
Non-Matches
::1
Author Rating: The rating for this expression. John Wilkins
Title Test Details Generic URI (RFC3986)
Expression
(?<scheme>[a-zA-Z][a-zA-Z0-9\+\-\.]*):(?://(?:(?<username>(?:[a-zA-Z0-9_~!&',;=\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))+):?(?:[a-zA-Z0-9_~!&',;=\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*@)?(?<host>(?:[a-zA-Z0-9_~!&',;=\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*)(?::(?<port>[0-9]*))?(?<path>(?:/(?:[a-zA-Z0-9_~!&',;=:@\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*)*)|(?<path>/(?:(?:[a-zA-Z0-9_~!&',;=:@\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))+(?:/(?:[a-zA-Z0-9_~!&',;=:@\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*)*)?)|(?<path>(?:[a-zA-Z0-9_~!&',;=:@\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))+(?:/(?:[a-zA-Z0-9_~!&',;=:@\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*)*))?(?:\?(?<query>(?:[a-zA-Z0-9_~!&',;=:@/?\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*))?(?:\#(?<fragment>(?:[a-zA-Z0-9_~!&',;=:@/?\.\-\$\(\)\*\+]|(?:%[0-9a-fA-F]{2}))*))?
Description
Generic RFC3986 compliant hierarchical URI. Does not support IPv6 literal strings as hosts. Does not validate a host address against any registry types. Does not validate a URI structure against scheme constraints. Provides named groups for scheme(protocol), username, host, port, path, query, and fragment.
Matches
http://www.google.com telnet://172.16.1.1:80 ftp://ftp.rfc-editor.org/in-notes/rfc3986.txt https://testapp/application?kjj98734087234897 ftp://username@testapp/pub/upload http://testapp/function.asp#appload
Non-Matches
www.google.com http://www.google.com:www/
Author Rating: Not yet rated. AB Chalmers
Title Test Details IPv6 (and IPv4) Address match with optional Port Number
Expression
(^|\s|(\[))(::)?([a-f\d]{1,4}::?){0,7}(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?=(?(2)\]|($|\s|(?(3)($|\s)|(?(4)($|\s)|:\d)))))|((?(3)[a-f\d]{1,4})|(?(4)[a-f\d]{1,4}))(?=(?(2)\]|($|\s))))(?(2)\])(:\d{1,5})?
Description
Too complex for a short explanation. It doesn't check for valid IP ranges and it also doesn't obey the rule, that a double colon in IPv6 only can exist once in the address notation. The optional port match at the end can be omitted. The RegEx has been constructed the way, that if an explicit identification fails, the complete match fails. For example someone write "My adress:2001::1234" the match will fail 'cos of the leading colon, even though it's an valid IPv6 address. A "My adress: 2001::1234" or "My adress:[2001::1234]" will work. Beware, that the RegEx is build for case-insensitive usage and no whitespaces are allowed inside the address. If you want to embed it into a larger RegEx, take into account to adjust the conditional matches wich refers to (?(2) -> (\[) inside (^|\s|(\[)) and (?(3) -> (::)? and (?(4) -> ([a-f\d]{1,4}::?) Works not perfectly, but I'm currently out of time.
Matches
::ffff:21:7.8.9.221 | 2001:0db8:85a3:08d3:1319:8a2e:0370:7344 | ::8a2e:0:0370:7344 | 2001:0db8:85a3:08d3:1319:8a2e:100.22.44.55 | 2001:0db8::8a2e:100.22.44.55 | ::100.22.44.55 | 100.22.44.55 | 100.22.44.55:80 | [::100.22.44.55]:8080 | [20ff::100.22.44.55]:8080
Non-Matches
20ff::100.22.44.55:8080 | ::8a2e:0:0370:7344.4 | 2001:0db8::8a2e:100.22.44.55:8080 | 2001:idb8::111:7.8.9.111 | 2001::100.a2.44.55 | :2001::100.22.44.55 | ffff:: (has to be fixed, 'cos a valid address)
Author Rating: Not yet rated. Gerry
Title Test Details IPv6 Address
Expression
(^\d{20}$)|(^((:[a-fA-F0-9]{1,4}){6}|::)ffff:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$)|(^((:[a-fA-F0-9]{1,4}){6}|::)ffff(:[a-fA-F0-9]{1,4}){2}$)|(^([a-fA-F0-9]{1,4}) (:[a-fA-F0-9]{1,4}){7}$)|(^:(:[a-fA-F0-9]{1,4}(::)?){1,6}$)|(^((::)?[a-fA-F0-9]{1,4}:){1,6}:$)|(^::$)
Description
This matches all valid forms of an IPv6 address. Including the compatibility form used to map IPv4 addresses. As well as the base-85 encoded integer form. It takes care of value range checking on the ipv4 part (components cannot exceed 0-255). This has been tested quite thoroughly, but considering the complexity and possibilities in the formation of an IPv6 address, matching errors are not guaranteed to be absent.
Matches
::5:aef1:ffff | ::ffff:240.65.238.22 | 0:0:0:0:0:0:0:1
Non-Matches
79250:9a0: | 8 | 91cf91d3da9
Author Rating: The rating for this expression. jteeuwen
Title Test Details Pattern Title
Expression
^(^(([0-9A-F]{1,4}(((:[0-9A-F]{1,4}){5}::[0-9A-F]{1,4})|((:[0-9A-F]{1,4}){4}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,1})|((:[0-9A-F]{1,4}){3}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,2})|((:[0-9A-F]{1,4}){2}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,3})|(:[0-9A-F]{1,4}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,4})|(::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,5})|(:[0-9A-F]{1,4}){7}))$|^(::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,6})$)|^::$)|^((([0-9A-F]{1,4}(((:[0-9A-F]{1,4}){3}::([0-9A-F]{1,4}){1})|((:[0-9A-F]{1,4}){2}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,1})|((:[0-9A-F]{1,4}){1}::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,2})|(::[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,3})|((:[0-9A-F]{1,4}){0,5})))|([:]{2}[0-9A-F]{1,4}(:[0-9A-F]{1,4}){0,4})):|::)((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{0,2})\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]{0,2})$$
Description
Matches all IPv6 text representations as defined within RFC 2373. Fairly verbose
Matches
::0:0:0:FFFF:129.144.52.38 | FEDC:BA98::3210:FEDC:BA98:7654:3210 | ::13.1.68.3
Non-Matches
FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:1234 | 3210:FEDC:BA98:7654:3210:1234 | :FEDC:BA98:7654:3210:
Author Rating: Not yet rated. Glynn Beeken
Title Test Details RFC3986 Generic URI
Expression
^([a-zA-Z][a-zA-Z0-9+-.]*):((\/\/(((([a-zA-Z0-9\-._~!$&'()*+,;=':]|(%[0-9a-fA-F]{2}))*)@)?((\[((((([0-9a-fA-F]{1,4}:){6}|(::([0-9a-fA-F]{1,4}:){5})|(([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:){4})|((([0-9a-fA-F]{1,4}:)?[0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:){3})|((([0-9a-fA-F]{1,4}:){0,2}[0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:){2})|((([0-9a-fA-F]{1,4}:){0,3}[0-9a-fA-F]{1,4})?::[0-9a-fA-F]{1,4}:)|((([0-9a-fA-F]{1,4}:){0,4}[0-9a-fA-F]{1,4})?::))((([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4}))|(([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5])))))|((([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4})?::[0-9a-fA-F]{1,4})|((([0-9a-fA-F]{1,4}:){0,5}[0-9a-fA-F]{1,4})?::))|(v[0-9a-fA-F]+\.[a-zA-Z0-9\-._~!$&'()*+,;=':]+))\])|(([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5]))\.([0-9]|(1[0-9]{2})|(2[0-4][0-9])|(25[0-5])))|(([a-zA-Z0-9\-._~!$&'()*+,;=']|(%[0-9a-fA-F]{2}))*))(:[0-9]*)?)((\/([a-zA-Z0-9\-._~!$&'()*+,;=':@]|(%[0-9a-fA-F]{2}))*)*))|(\/?(([a-zA-Z0-9\-._~!$&'()*+,;=':@]|(%[0-9a-fA-F]{2}))+(\/([a-zA-Z0-9\-._~!$&'()*+,;=':@]|(%[0-9a-fA-F]{2}))*)*)?))(\?(([a-zA-Z0-9\-._~!$&'()*+,;=':@\/?]|(%[0-9a-fA-F]{2}))*))?((#(([a-zA-Z0-9\-._~!$&'()*+,;=':@\/?]|(%[0-9a-fA-F]{2}))*)))?$
Description
Manually derived this from the grammar in Appendix A of RFC3986 (Uniform Resource Identifier (URI): Generic Syntax). Matches anything that fits the generic syntax of a URI. Supports IPv6 hosts.
Matches
http://user:[email protected]:123/dir/subdir/?qp1=v%d3&qp2=98#frag | http://192.168.0.0:123/dir/subdir/?qp1=v%d3&qp2=98#frag | svn+ssh://[D456::1234:4321]:123/dir/subdir/?qp1=v%d3&qp2=98#frag
Non-Matches
http://user:pwddomain.com:123/dir/subdir/?qp1=v%d3&qp2=98#frag | http://192.168.0.0:123/dir/subdir/?qp1=v%d&qp2=98#frag | svn+ssh://[D456::12344321]:123/dir/subdir/?qp1=v%d3&qp2=98#frag
Author Rating: The rating for this expression. James Lentini
   Displaying page 1 of 1 pages; Items 1 to 17

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