Thursday, July 7, 2011

Regular Expression to filter HTML Tags

Following is a simple way by which one can filter out the html tags say from ajax responses etc…


normalString=htmlString.replace(/<\/?[^>]+(>
$)/g, "");

inorder to filter out carriage returns one can use

String. replace(/\n/g, "");

No comments:

Post a Comment