Ask a Question related to ASP, Design and Development.
-
Lasse Edsvik #1
filter html-tags, but not all...
Hello
I was wondering if you guys could help me. im building a small messageboard
and i want to filter all html-tags except these ones:
<b> <i> <img.........> <font....>
how to build such a reg exp pattern?
TIA
/Lasse
Lasse Edsvik Guest
-
Using HTML tags in Flash
Hello I have some XML that's loaded into Flash by ActionScript and in the XML, I have some text under a node as a parameter called "content" but... -
html character enities and other html tags in Contribute3.x
If you need support/integration of additional html character entities and other html tags in Contribute 3.x, please let Macromedia know that you are... -
InDesign CS - HTML Export Filter
Product name: InDesign Version: CS Operating system: Windows How to export to HTML format ? The plug-in "HTML export Filter" doesn't exist... -
search in html tags
hi friends i am not prof programmer but, in my program i save content by editor online and when i want to search content i have this problem : ... -
How to use HTML::Parser to remove HTML tags and print result
I am trying to use HTML::Parser to parse an HTML file, remove all HTML tags (including comments, etc.), replace all ENTITIES (e.g. &), and put... -
Ray at #2
Re: filter html-tags, but not all...
I ~guess~ this non-regular expression may work:
sPost = Request.Form("TheTextArea")
sPost = Replace(sPost, "<", "<")
sPost = Replace(sPost, "<b>", "<b>")
sPost = Replace(sPost, "</b>", "</b>")
sPost = Replace(sPost, "<i>", "<i>")
sPost = Replace(sPost, "</i>", "</i>")
sPost = Replace(sPost, "<img", "<img")
sPost = Replace(sPost, "<font", "<font")
sPost = Replace(sPost, "</font>", "</font>")
If I got that right, it'll replace all the <'s with <'s, and then go back
and re-replace the <b, <i, <img, <font and they're closing equivalents.
This will still leave > everywhere, but that shouldn't matter. I'm sure
there is a more robust solution out there, anyway.
Ray at work
"Lasse Edsvik" <lasse@nospam.com> wrote in message
news:OKaELmInDHA.2216@TK2MSFTNGP12.phx.gbl...messageboard> Hello
>
> I was wondering if you guys could help me. im building a small> and i want to filter all html-tags except these ones:
>
> <b> <i> <img.........> <font....>
>
> how to build such a reg exp pattern?
>
> TIA
> /Lasse
>
>
Ray at Guest
-
Lasse Edsvik #3
Re: filter html-tags, but not all...
hmm, i was hoping for a reg.exp solution
/Lasse
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:uz42k8JnDHA.3700@TK2MSFTNGP11.phx.gbl...back> I ~guess~ this non-regular expression may work:
>
>
> sPost = Request.Form("TheTextArea")
> sPost = Replace(sPost, "<", "<")
> sPost = Replace(sPost, "<b>", "<b>")
> sPost = Replace(sPost, "</b>", "</b>")
> sPost = Replace(sPost, "<i>", "<i>")
> sPost = Replace(sPost, "</i>", "</i>")
> sPost = Replace(sPost, "<img", "<img")
> sPost = Replace(sPost, "<font", "<font")
> sPost = Replace(sPost, "</font>", "</font>")
>
>
> If I got that right, it'll replace all the <'s with <'s, and then go> and re-replace the <b, <i, <img, <font and they're closing equivalents.
> This will still leave > everywhere, but that shouldn't matter. I'm sure
> there is a more robust solution out there, anyway.
>
> Ray at work
>
> "Lasse Edsvik" <lasse@nospam.com> wrote in message
> news:OKaELmInDHA.2216@TK2MSFTNGP12.phx.gbl...> messageboard> > Hello
> >
> > I was wondering if you guys could help me. im building a small>> > and i want to filter all html-tags except these ones:
> >
> > <b> <i> <img.........> <font....>
> >
> > how to build such a reg exp pattern?
> >
> > TIA
> > /Lasse
> >
> >
>
Lasse Edsvik Guest
-
Bob Barrows #4
Re: filter html-tags, but not all...
Lasse Edsvik wrote:
Patience. Chris (Hohmann) usually doesn't start posting this early in the> hmm, i was hoping for a reg.exp solution
>
day. ;-)
If you're really impatient, you may want to Google this group for some of
Chris' RegExp posts that may help you figure it out for yourself...
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows Guest
-
Evertjan. #5
Re: filter html-tags, but not all...
Lasse Edsvik wrote on 27 okt 2003 in
microsoft.public.inetserver.asp.general:
This answer is in [serverside-asp ;-)] Jscript> I was wondering if you guys could help me. im building a small
> messageboard and i want to filter all html-tags except these ones:
>
> <b> <i> <img.........> <font....>
>
> how to build such a reg exp pattern?
and supposes you also want to keep </b>, </i>, etc.
// replace the < of those 8 with ##&##
t = t.replace(/<{1}?(?=\/?(b|i|img|font)( |>))/g,"##&##")
// replace all other tags with a space
t = t.replace(/<[^>]+>/g," ")
// replace all ##&## back to <
t = t.replace(/##&##/g,"<")
=========================
// all in one single line:
t = t.replace(/<{1}?(?=\/?(b|i|img|font)( |>))/g,"##&##").replace(/<[^>]
+>/g," ").replace(/##&##/g,"<")
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Evertjan. Guest



Reply With Quote

