I use split(" ")
for whitespace and use split(/(<[^>]*>)/)
for html tag in string.
but i have to use together. i want to divide a string by whitespace and html tag and put it into an array. i don't want to lose anything. string, html tag both.
whitespace is \s
and html tag is split(/(<[^>]*>)/)
and i used like this new RegExp("\s+(<[^>]*>)", "g");
but it doesn't work.
var htmlTagRegex = new RegExp("\s+(<[^>]*>)", "g");
var str = ""<div class="tab0">CSS code formatter</div><div class="tab2">CSS code compressor</div>";
var myArray = str.split(htmlTagRegex);
if(myArray != null){
for ( i = 0; i < myArray.length; i++ ) {
var result = "myArray[" + i + "] = " + myArray[i]+"<br />";
$(".tt-sns-clear").append(result);
}
}