better regular expression?

Roy Smith roy at panix.com
Mon Dec 6 20:01:52 EST 2004


"Vivek" <vivek.bhaskar at gmail.com> wrote:

> Hi,
> 
> I am trying to construct a regular expression using the re module that
> matches for
> 1. my hostname
> 2. absolute from the root URLs including just "/"
> 3. relative URLs.

Is your goal to learn more about regexes, or to parse URLs?  If the 
latter, my suggestion would be to look at the urlparse module; the hard 
work has already been done for you.



More information about the Python-list mailing list