Wrox Home  
Search P2P Archive for: Go

  Return to Index  

regular_expressions thread: Re: URL Parsing


Message #1 by pgtips@m... on Fri, 18 Oct 2002 12:28:36
This one seems to work:
"(www\.)([^(<| )]+) *(<(.|\n)+?>)*"

but i'm not 100% sure what you're trying to get...

hth
Phil
>-----------------------------------------
> I've a problem with parsing url's from a string.

> The code is like this:

> strURL = "www.yahoo.com"

> Set objReg = new RegExp
o> bjReg.IgnoreCase = true
o> bjReg.Global = true
o> bjReg.Pattern = "(www\.)([^(<| )]+)"
s> trURL = objReg.Replace(strURL ,"$2")
S> et objReg = Nothing

> This RegExp works great if the strURL is like "www.yahoo.com". But if 
t> here is any html tags after the url, the script doesn't 
w> ork. "www.yahoo.com<br>" returns "yahoo.com<br>" or "www.yahoo.com 
<br>" 
r> eturn "yahoo.com <br>"

> How can I prevent this tags and whitespaces parsed along with th url?

  Return to Index