Source:

var result =html.replace(new RegExp('(]+)>', 'g'),"$1 />");