Return to Snippet

Revision: 33766
at October 13, 2010 05:24 by rumremix


Initial Code
<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>

Initial URL

                                

Initial Description

                                

Initial Title
strip html tags from a string in Javascript

Initial Tags
javascript, html

Initial Language
JavaScript