Forum Moderators: open
thanks
I've been trying to get some info on how ASP deals with pattern matching, but with little success.
I can only find examples of using the 'islike' function, where it returns true or false for a matched pattern - do you know if it supports substitution etc?
'Assume strHTML contains the HTML with the <a href="URL">URL Description</a>
'We want to store into strText the HTML in strHTML, but with the HREF tags
'changed to a more text-friendly URL Description [URL]
'First, create a reg exp object
Dim objRegExp
Set objRegExp = New RegExp
objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "<a\s+href=""http://(.*?)"">\s*((\n¦.)+?)\s*</a>"
'Now, replace the HREF tags with our preferred format
strText = objRegExp.Replace(strHTML, "$2 [http://$1]")