I\'m trying to remove white space between tags so that childNodes only contain those tags nodes not the white space nodes too. Here\'s my code :
only spaces:
parentHTML = parentHTML.replace( new RegExp( "\>[ ]+\<" , "g" ) , "><" );
new line, tabs and spaces:
parentHTML = parentHTML.replace( new RegExp( "\>[\s]+\<" , "g" ) , "><" );
https://regex101.com/r/sD7cT8/1