how to split <p><span>Hello</span></p>
to <span>Hello</span>
using javascript
var text = "<p><span>Hello</span></p>";
remember:I don't know what contain <p>
, I don't know if <p>
has any attribute or not
I found the answer !
var patt=/^<p.*?>(.*)<\/p>$/i;
var result=patt.exec(text);
alert(result[1]);
thank's ring0 & w3schools http://www.w3schools.com/jsref/jsref_obj_regexp.asp
but there is problem ! it doesn't work with
aa<p><span>Hello</span></p>aa