homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

Regex problems
Don't think i'm using Matches correctly

 10:42 am on Jul 23, 2004 (gmt 0)

Hi all, I'm trying to use regex to take the contents of the title tag from a html page but cant get rid of the <title> tags on either side my code looks like this:

Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Global = True
regEx.Pattern = "<title>(.*)</title>"

Set Matches = regEx.Execute(strPage)
strTitle = Matches.Item(0).Value


It returns something like "<title>Best widgets</title>" and I want "Best widgets". I've seen examples with $1 in to return certain bits but am not sure how to use them outside of the replace method - can anyone help me out?





 11:45 am on Jul 23, 2004 (gmt 0)


Use this function to remove all html from a string

Function RemoveHTML( strText )
Dim RegEx

Set RegEx = New RegExp

RegEx.Pattern = "<[^>]*>"
RegEx.Global = True

RemoveHTML = RegEx.Replace(strText, "")
End Function


 11:16 am on Jul 25, 2004 (gmt 0)

That works great thanks :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved