View Full Version : Erasing html tags
02-14-2003, 08:04 PM
If I am given any link such as:
<a href="http://blah">I want this text</a>
How do I chop off the html tags so I get just "I want this text"?
Is regular expressions the only way to accomplish this?
02-15-2003, 01:57 AM
02-26-2003, 11:01 AM
var sHTML = variableName;
sHTML = sHTML.replace(/<[^>]*>/g, "");
So if you're pulling stuff from a form just call the function on submit and use the form reference instead of variable name.
If you want to do it using ASP/VBScript, go to this article of 4guys... tells you everything you need to know.
02-27-2003, 12:45 AM
Sorry I didn't elaborate more, with your experience I figured you could find plenty of examples, such as the one dominicall posted.
Strangely enough, I was working with another developer today parsing out https?\/\/\s?=\s?["']([^"'\s]*) links (something like that).
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.