473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Replace HTML

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.
Jul 22 '05 #1
3 2027
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
Jul 22 '05 #2
"Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
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 ? :)
Jul 22 '05 #3
"John Smith" wrote in message news:gb********************@pipex.net...
: "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
: news:%2***************@tk2msftngp13.phx.gbl...
: > 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
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
12
by: Barnes | last post by:
Does anyone know of a good way to use the JavaScript string.replace() method in an ASP form? Here is the scenario: I have a form that cannot accept apostrophes. I want to use the replace() so...
2
by: Barnes | last post by:
Hi, Can anyone please tell me how I can use the replace method to replace a character if it occures in more than one textbox without having to write separate function for each textbox. The...
2
by: JHB | last post by:
Hi, How can I do a location.replace when I use a form, like when I use a href? This works. <a href="Ny HTML-side20.htm"; method="post" id="frm" name="BrugerHovedSide"...
7
by: Iain King | last post by:
I have some code that converts html into xhtml. For example, convert all <i> tags into <em>. Right now I need to do to string.replace calls for every tag: html = html.replace('<i>','<em>')...
5
by: Casey | last post by:
Hello, Can someone give me specific code to replace text on a page using server side javascript? I need to use server-side because I need the output to be recognized in the final HTML so that...
12
by: Michael | last post by:
In PHP there is a function called str_replace (http://php.net/str_replace). Basically you can freed in two strings and a "subject" string. Then it goes through the subject string searching for...
3
by: gregpinero | last post by:
Hi guys, What I'm trying to do is find all instances of an acronymn such as IBM on a webpage and replace it with <acronym title="International Business Machines">IBM</acronym>. However in my...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.