-3

Good day. I need to remove all HTML from text. The problem is - some attributes has "<" and ">" symbols in.

I use this rules:

var tmp = html.replace(/(<([^>]+)>)/ig,"") // remove tags
          .replace(/\s/g, "" ); // inline

But its steal has some 0!"> from atributes. Please, see my example on JSFiddle: http://jsfiddle.net/3nn9wmy7/

nomn
  • 3
  • 1

2 Answers2

0

It's not regex so please be gentle: in jQuery

$("*").text(); 

$("*") selects all elements .text() selects the text between tags

http://jsfiddle.net/g9t3bLvz/

I hope you can go further from here

online Thomas
  • 7,441
  • 5
  • 32
  • 67
-3

I find unswer. Author is itsadok (https://stackoverflow.com/users/7581/itsadok)

<(?:"[^"]*"['"]*|'[^']*'['"]*|[^'">])+>
Community
  • 1
  • 1
nomn
  • 3
  • 1