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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find URL Capture
Expression
^(?<scheme>(?:http|https|ftp|telnet|gopher|ms\-help|file|notes)://)?(?:(?<user>[a-z][\w~%!&amp;',;=\-\.$\(\)\*\+]*):(?<password>.*)?@)?(?:(?<domain>(?:[a-z0-9]\w*[a-z0-9]*\.)*(?:(?:(?:[a-z0-9]\w*[a-z0-9]*)(?:\.[a-z0-9]+)?)|(?:(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))))(?::(?<port>[0-9]+))?)?(?:(?<path>(?:/(?:[\w`~!$=;\-\+\.\^\(\)\|\{\}\[\]]|(?:%\d\d))+)*/(?:[\w`~!$=;\-\+\.\^\(\)\|\{\}\[\]]|(?:%\d\d))*)(?<params>\?[^#]+)?(?<fragment>#[a-z0-9]\w*)?)?$
Description
break apart all possible elements of a url to every possible url part
Matches
http://username:password@subdomain1.subdomain2.google.com:5000/test?q=2121ddf&opt=blah#ttg | http://127.0.0.1/path/to/?q=45 | telnet://192.0.2.16:80/ | /index.html
Non-Matches
user@172.168.0.1 | ../index.html | cgi-bin/version.pl
Author Rating: Not yet rated. ASM™
Source
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

Title: Possible problem
Name: Toby
Date: 9/23/2011 2:13:38 PM
Comment:
Doesn't find URL with ? but no params: "http://www.google.com/?" or "http://www.google.com/?#blah"


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