/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>