Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Regular Expression for URL

Reply
Thread Tools

Regular Expression for URL

 
 
SROSeaner
Guest
Posts: n/a
 
      10-08-2004
I am working on an ASP page which looks in a set of text for web page URLs.

Using the VBScript.RegExp regular expression object, I have this regular
expression:

[a-z]+\.[a-z]+\.[a-z]+/

And it works well finding URL's such as: windowsupdate.microsoft.com,
www.cnn.com, etc.

However, I have been trying to modify it to ALSO find URL's like this:

www.amazon.com/index/sell/ie6.html?val=1
Or
www.microsoft.com/windowsxp

Any ideas?
 
Reply With Quote
 
 
 
 
Lasse Edsvik
Guest
Posts: n/a
 
      10-08-2004
SROSeaner,


Function LinkURL(stringa)
Dim objRegExp, strTemp
Set objRegExp = New RegExp

objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "(\b(www\.|http\://)\S+\b)"
strTemp = objRegExp.replace(stringa, "<A HREF='http://$1'
class='orangelnk' TARGET='_new'>$1</A>")
LinkURL = Replace(strTemp, "http://http://","http://")
Set objRegExp = Nothing
End Function



"SROSeaner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am working on an ASP page which looks in a set of text for web page

URLs.
>
> Using the VBScript.RegExp regular expression object, I have this regular
> expression:
>
> [a-z]+\.[a-z]+\.[a-z]+/
>
> And it works well finding URL's such as: windowsupdate.microsoft.com,
> www.cnn.com, etc.
>
> However, I have been trying to modify it to ALSO find URL's like this:
>
> www.amazon.com/index/sell/ie6.html?val=1
> Or
> www.microsoft.com/windowsxp
>
> Any ideas?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Seek xpath expression where an attribute name is a regular expression GIMME XML 3 12-29-2008 03:11 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C++ 42 11-04-2008 12:39 PM
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" Adem C Programming 45 11-04-2008 12:39 PM
Matching abitrary expression in a regular expression =?iso-8859-1?B?bW9vcJk=?= Java 8 12-02-2005 12:51 AM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM



Advertisments