> Yeah, just tried it, copy the below into a plain text file...
>
> 'Start
>
> MsgBox stripHTML("<p><b><font face=""arial"">The number 3 is > number
> 2.</b></p>")

True, that was taken into consideration when I wrote the function.

However, it WILL fail with something like:
<p>I know that 5<6 and 6>5.</p>
which returns: I know that 5 5.

It'll also fail if there is an ASP variable as an attribute value, such
as:
<p style="background:<%= bgcolor %>;">

I solved the second issue by using a similar function to first strip ASP
markup.

When the original poster gets upgraded, this regex function (by Scott
Mitchell at 4Guys) does the same and might be useful.

Function stripHTML(strHTML)
'Strips the HTML tags from strHTML vbs5.5 required

  Dim objRegExp, strOutput
  Set objRegExp = New Regexp

  objRegExp.IgnoreCase = True
  objRegExp.Global = True
  objRegExp.Pattern = "<.+?>"

  'Replace all HTML tag matches with the empty string
  strOutput = objRegExp.Replace(strHTML, "")

  'Replace all < and > with &lt; and &gt;
  strOutput = Replace(strOutput, "<", "&lt;")
  strOutput = Replace(strOutput, ">", "&gt;")

  stripHTML = strOutput    'Return the value of strOutput

  Set objRegExp = Nothing
End Function

--
Lonnie Kraemer
-----------------------------------------


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to