Hi,
is there a function to clean a variable of HTML tags.
this variable is being sent from a database call.
please advise

Re: remove HTML from variables by tlavedas

tlavedas
Wed Apr 06 12:28:00 CDT 2005

Maybe something like this would serve ...

-------------- Begin --------------
wsh.echo NoTags("<div>Some text</div>")

Function NoTags(sHTML)
with CreateObject("InternetExplorer.Application")
.Navigate "about:blank"
Do until .ReadyState = 4 : WSH.Sleep 100 : Loop
With .document
.open
.write "<body id=holder>" & sHTML & "</body>"
.close
Do until .ReadyState = "complete" : WSH.Sleep 100 : Loop
NoTags = .all.holder.innerText
End With ' document
End With ' IE
End Function
-------------- End --------------

This code works as written, but I have not done extensive testing.
Some HTML code tags might cause problems - I have no idea what those
might be - just haven't tested it much.

Tom Lavedas
==============

Rafael Chemtob wrote:
> Hi,
> is there a function to clean a variable of HTML tags.
> this variable is being sent from a database call.
> please advise


Re: remove HTML from variables by Rafael

Rafael
Fri Apr 08 03:32:25 CDT 2005

Rafael,

Here is something that migght help,

set objRE = new RegExp
dim sTag

objRE.Pattern="<\S[^>]*>"
objRE.Global=true
'html tags in a variable
sTag="<html><head><title>Title page here</title></head><body>Page content
here</body></html>"

'clean
sTag=objRE.Replace(sTag,"")
'show
msgbox sTag

set objRE=nothing

RT

"Rafael Chemtob" <rchemtobb@nospam.yahoo.com> wrote in message
news:umbDoLsOFHA.3928@TK2MSFTNGP09.phx.gbl...
> Hi,
> is there a function to clean a variable of HTML tags.
> this variable is being sent from a database call.
> please advise
>
>