* symbol selects 0 or one or more given expressions,
? 0 or one symbol selected,
*? This should be a non-greedy choice, with a single? Is there any difference?
const tags = /^(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;
function convert(html) {
return html.replace(
/(<(\w+)[^>]*?)\/>/g, (all, front, tag) => {
return tags.test(tag) ? all :
front + "></" + tag + ">";
});
}
this function is used to close non-auto-closing elements like < table/ >, but it doesn"t quite understand the author"s use of * in replace. Instead of?.