Possible Duplicate:
The Hostname Regex
I'm trying to use pcrepp (PCRE) to extract hostname from url. the pcre regular expression is as same as Perl 5 regular expression.
for example:
url = "http://www.pandora.com/#/volume/73";
// the match will be "http://www.pandora.com/".
I can't find the correct syntax of the regex for this example.
- Needs to work for any url:
amazon.com/sds/
should return:amazon.com
. orabebooks.co.uk/isbn="62345627457245"/blabla/
should returnabebooks.co.uk
- I don't need to check if the url is valid. just to get the hostname.