Discussion Locked

How do you strip out HTML tags?

0 helpful
6 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

i am trying to strip out HTML tags from a given string using regular expressions in vb script.
does anyone know how to do it.
i'm close with this:
regEx.Pattern = "<[^>]*>" - but it doesn't let you input things like 1<5.
i would be very grateful of any help.
cheers
lb

6 replies

by zlatin zlatev

You can use invisible control and innerHTMLand innerText properties.
example:

Note:
I've tested this with IE 5.5 and VBS 5.5

Best wishes,
Zlatin Zlatev,
MCP SQL Server 7.0,
Mentor Programmer&Software Engineer,
JEI-Bulgaria

by juanja

Here is a piece of code. Paste it in a html page and test it. The source is a textbox, but you can make it whatever you want.

IT DOES ALLOW "1<5" or "1>5"

I did this just for you, so excuse the appereance and the lack of comments.

You can use it as long as you don't remove my header (name)

Enjoy it.

bye

by juanja

Me again. When I uploaded it, the thing took out the identation so everything is now vertical, and very hard to understand. If you want, let me know and I'll e-mail you a copy with spaces. bye

by lee_button

Thank you very much. This answer was just the sort of thing I was looking for.
Cheers, best regards

Lee

This discussion is closed to new replies.