Source: http://nadeausoftware.com/articles/2008/05/php_tip_how_parse_and_build_urls#Code
Copyright (c) 2008, David R. Nadeau, NadeauSoftware.com
BSD Licensed.
Modified by Michael Crumley (added named match groups)
| Text | Result |
|---|---|
/search?q=regular%20expression
| match |
http://www.google.com/
| match |
http://www.google.com/search?q=regular%20expression
| match |
www.google.com/
| match |
schemeuserpasshostportpathqueryfragmentThe URL www.example.com/ will match as a relative URL with the path "www.example.com/". This is not a bug!
If the base url were http://domain.com/, this would point to http://domain.com/www.example.com/.