How to strip HTML tags from string in JavaScript? [duplicate]
cleanText = strInputCode.replace(/<\/?[^>]+(>|$)/g, “”); Distilled from this website (web.achive). This regex looks for <, an optional slash /, one or more characters that are not >, then either > or $ (the end of the line) Examples: ‘<div>Hello</div>’ ==> ‘Hello’ ^^^^^ ^^^^^^ ‘Unterminated Tag <b’ ==> ‘Unterminated Tag ‘ ^^ But it is not bulletproof: … Read more