Regex Help!

Bes

Bes

Soldato
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
Hi,

I am trying to derive just the domain name from a URL with a regex (No backreferences available as this is in Javascript), but cannot get it to work, I always capture a / in front of my string, so I get /www.johnlewis.com. Can anyone help?


PHP:
[^\w*:\/]?\/[\-a-z\.]+

http://www.johnlewis.com/370705/Product.aspx

Thanks!
 
Back
Top Bottom