home page latest news web development curriculum vitae consulting contact me

NETART MEDIA is one of the fast growing European IT companies striving to offer high quality web and e-commerce products, like for example:

Blog System v1.1

WebSiteAdmin v2.0

Jobs Portal v1.0

Cars Portal v1.1

Pharmacy System


How to strip HTML tags from a string with a simple regular expression using JavaScript?

(DHTML free example written by Anton Zamov.
Need a professional consulting or development service? Click here!)

How to strip HTML tags from a string with a simple regular expression using JavaScript?

<HTML>
<HEAD>
<TITLE> Regular Expressions: stripping HTML tags </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
var htstring = '<p align="Left"><b>Hello</b> <I>World</I></p>';
var stripped = htstring.replace(/(<([^>]+)>)/ig,"");

with (document) {
write ('Original string:' + htstring + '<br>');
write ('Stripped string:<br><br>' + stripped);
}
</SCRIPT>
</BODY>
</HTML>



C# (Microsoft .NET) | JAVA | Dynamic HTML | PHP & MySQL | Perl & CGI | C | C++ | Vector Markup Language
SMIL | Assembler | Databases | Wap Development | Web site promotion | Web Marketing

Copyright © Anton Zamov 1998-2003