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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find 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
Source Based on ABNF URI form - ftp://ftp.rfc-editor.org/in-notes/rfc3986.txt
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

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