the following code:
let exp = null;
try {
// firefox make this error
exp = new RegExp("(?<!\\$)\\$(\\d+|\\w+?\\b)", "g");
} catch (error) {
exp = new RegExp("\\$(\\d+|\\w+?\\b)", "g");
}
/**
*
*
* @param {String} format
* @param {...any} args
*/
export default function printf(format, ...args) {
return format.replace(exp, function (target, name) {
if (args.length === 1 && args[0] instanceof Object) {
return args[0][name] || target;
} else {
return args[name] || target;
}
});
}
now I wonder if bug
feels that Firefox parses the prefix as a group