Tuesday, 20 August 2013

Split text avoiding some cases (Javascript)

Split text avoiding some cases (Javascript)

i'm trying to split an html like this as a string:
<p class='class1'> Hello, this is my html </p>
what i need is to split that html by spaces ignoring the html tags in the
split, i am currently getting this result:
["<p","class='class1'>","Hello,","this","is","my","html","</p>"]
but i need it to treat the tags as a complete word, to get this result:
["<p class='class1'>","Hello,","this","is","my","html","</p>"]
how can i get to this result?
Thanks in advance.

No comments:

Post a Comment