in reply to Re: Regex for extracting a domain name from a string.
in thread Regex for extracting a domain name from a string.

Indeed. My take on the matter is ... what this person wants to get is:   “this-or-that part of ‘a domain name.’” And it so happens that the “obvious way” to get there is... “well, (obviously) I have to (figure out how to) write a regular expression” before I'll be able to “get that.”

And I'm reaching over and hitting the Pause button and saying... “oh, really?” I'll bet that there's a very good CPAN-module already out there which will give you the answer that you want. I'll wager that in fact you don't have to tackle regular-expressions in order to get the result you want, because somebody out there has already done it and has done it very well.

Dictum Ne Agas — “Do Not Do A Thing Already Done.”

Replies are listed 'Best First'.
Re^3: Regex for extracting a domain name from a string.
by Cody Pendant (Prior) on Feb 28, 2008 at 03:51 UTC
    For the "this or that part", they need a different module which can extract the parts like host, path, query string, port etc. etc.


    Nobody says perl looks like line-noise any more
    kids today don't know what line-noise IS ...