in reply to Regular Expression Question
This doesn't have exactly the same functionality as your function (specifically, it chops the trailing slash), but that's easy to modify if you want. You may also want to look into the Perl module called "URI".sub getDomain { my ($url) = @_; $url =~ m#(http://[^/:]+)#i; return $1; }
Update: changed return $url; to return $1;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Expression Question
by shaolin_gungfu (Novice) on Apr 29, 2002 at 19:41 UTC |