Replace HTML

J

John Smith

Hi,

I'm building a search engine for a site that uses HTML in the content
management. I wanted to return search results but also filter out any HTML
code that might interfere with the search results formatting. Is there an
easy way of doing this or am I left with the option of using replace against
various tags ?

Thanks

J.
 
C

Curt_C [MVP]

John said:
Hi,

I'm building a search engine for a site that uses HTML in the content
management. I wanted to return search results but also filter out any HTML
code that might interfere with the search results formatting. Is there an
easy way of doing this or am I left with the option of using replace against
various tags ?

Thanks

J.

Do a search for HTMLDeCode.. I know there have been a whole bunch of
versions of this written by individuals over the years.
 
R

Roland Hall

"John Smith" wrote in message : "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
: : > John Smith wrote:
: >> Hi,
: >>
: >> I'm building a search engine for a site that uses HTML in the content
: >> management. I wanted to return search results but also filter out any
: >> HTML code that might interfere with the search results formatting. Is
: >> there an easy way of doing this or am I left with the option of using
: >> replace against various tags ?
: >>
: >> Thanks
: >>
: >> J.
: >
: > Do a search for HTMLDeCode.. I know there have been a whole bunch of
: > versions of this written by individuals over the years.
: >
: > --
: > Curt Christianson
: > site: http://www.darkfalz.com
: > blog: http://blog.darkfalz.com
:
: The only one i could find that wasn't .net was :
:
: http://www.devx.com/vb2themax/Tip/19163
:
: Which only seems to convert HTML sent using the GET method to it's proper
: HTML equivilent ?
:
: Am I missing something ? :)

Don't remember where I got this or if it's what you're looking for...

Private Function HTMLDecode(byVal encodedstring)
Dim tmp, i
tmp = encodedstring
tmp = Replace(tmp, "&quot;", chr(34))
tmp = Replace(tmp, "&lt;" , chr(60))
tmp = Replace(tmp, "&gt;" , chr(62))
tmp = Replace(tmp, "&amp;" , chr(38))
tmp = Replace(tmp, "&nbsp;", chr(32))
For i = 1 to 255
tmp = Replace(tmp, "&#" & i & ";", chr(i))
Next
HTMLDecode = tmp
End Function

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top