Thanks Lonnie, Nick and anyone else who replied. It'll work just fine. It
will be used to strip HTML formatting particularly when users cut and paste
stuff from WORD and OUTLOOK into my web forms. Their input is used to form
news bulletins and it gets stupid when the size 36 purple bold italicized
Comic Sans font nonsense they pasted into my form fields show up in
bulletins that I want to use black 12pt Arial font in.


----- Original Message -----
From: "Lonnie.Kraemer" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 5:44 PM
Subject: Re: Removing all HTML tags


> > 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.unsub%%
>


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

Reply via email to