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
A regular expression that takes care of removing
pattributesOr a version with
.*?And if
<pre>or<param>may start thetext, you have to prevent a matchedit to answer your second question
To remove whatever is before / after
But if you want to remove all
<p...>and all</p>, you should use the two lines