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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find URL Parsing
Expression
(?:(?<scheme>[a-zA-Z]+)://)?(?<domain>(?:[0-9a-zA-Z\-_]+(?:[.][0-9a-zA-Z\-_]+)*))(?::(?<port>[0-9]+))?(?<path>(?:/[0-9a-zA-Z\-_.]+)+)(?:[?](?<query>.+))?
Description
Separates a URL into components viz. schema, domain, port, path and query. Avoids unnecessary numbered groups caused by braces.
Matches
http://www.google.com/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | ftp://ftp.google.com:21/Files/Data.zip | http://www.google.com:80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta=
Non-Matches
http:/www.google.co.za:80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | http://www.google.co.za?80/cgi/search?hl=en&q=RegEx+Library&btnG=Google+Search&meta= | http://www.google.co.za:80/cgi/search/hl=en&q=RegEx+Library&btnG=Google+Search&meta=
Author Rating: Not yet rated. Raje
Source Self
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-2024, RegexAdvice.com | ASP.NET Tutorials