I'm trying to write a regex for extracting URLs, and have one tricky case I can't catch. I'm now using the following (greedy) regex

(http|https)://(((.*):(.*)@)?)(@)?([^:>/\s""]*)

which (as far I can see) will catch URLs like

http://www.foo.com
http://www.foo.com/bar
http://www.foo.com:80/bar
http://www.foo.com:80/bar:bar
http://user:[EMAIL PROTECTED]:80/bar
http://@www.foo.com:80/bar

but will fail on this

http://@www.foo.com:80/[EMAIL PROTECTED]

Any help very much appreciated (and I would prefer to stay pure regex, with no post processing of the match)

  *************************************************************
  Christer Olsson   PO Box 9160        Phone +46 40 25 85 85
  Ljusa Idéer AB    SE-200 39 Malmo    Fax +46 40 25 85 89
  Kantyxegatan 5    Sweden             http://www.ljusaideer.se


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to