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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
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
   Displaying page 1 of 1 pages; Items 1 to 1

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