String Regex problem
Fazer
faizan at jaredweb.com
Tue Nov 25 16:32:02 EST 2003
djw <dwelch91.nospam at comcast.net> wrote in message news:<fSzwb.293286$HS4.2642954 at attbi_s01>...
> Fazer wrote:
> > Hello,
> >
> > I have a string which has a url (Begins with a http://) somewhere in
> > it. I want to detect such a url and just spit out the url. Since I
> > am very poor in regex, can someone show me how to do it using a few
> > examples?
> >
> > Thanks a lot!
>
> I would look here to improve your re-ex skills:
>
> http://www.amk.ca/python/howto/regex/
>
> Also, I find Kodos to be invaluable in developing and debugging regexs.
> Highly recommended.
>
> http://kodos.sourceforge.net
>
> Of course, you could just use urlparse in the standard library...
>
> Good luck,
>
> Don
Wow awesome! Thanks a lot for kodos. I hope I find it useful. I
have actually found a better solution rather than using regex it self.
Here's my solution and I think it works well:
[x for x in moo.split(' ') if x.startswith('http://')]
More information about the Python-list
mailing list