RegExp
const tags = ; let input = "*)";let reg1 = tagsregexp`\\\(\g`; // the above line is same aslet inputEscaped = input;reg1 = "\\\\\\(" + inputEscaped "g"; // string-tags make regexp much cleaner when you have to use expression in regexp // don't use string-tags for regexp when there is no expression, use native js syntax instead:reg1 = /\\\(\*\)/g;
XML
const tags = ; let input = "&<>";let xml1 = tagsxml`<a></a>`; // escape the xml stringlet dom = tagsdom_xml`<a></a>`; // output a document instead of string