var str= dasa ; var reg = /<([a-z]+?)(?:\s+?[^>]?)?>\s?</\1>/ig; if(reg.test(str)) { str= str.replace(reg,""); }