Blurr icon indicating copy to clipboard operation
Blurr copied to clipboard

Regex bug

Open NicotineLL opened this issue 10 years ago • 3 comments

I've tried using the script on Codepen and it worked, but when installing it locally the console returned an error.

Uncaught SyntaxError: missing ) after argument list" on line 208

Now the line with the problem is actually the previous one

_tpl = _tpl.replace(/{{i}}/g, this.elementCount);

The browser reads it like

_tpl = _tpl.replace(//g, this.elementCount);

because it's not escaped. It should be

_tpl = _tpl.replace(/\{\{i\}\}/g, this.elementCount);

NicotineLL avatar Dec 13 '15 11:12 NicotineLL

Thanks for the heads up! Fancy submitting a pull request?

tomhallam avatar Dec 18 '15 12:12 tomhallam

I'm not really that into Github and I don't know how things work around here. Just wanted to report the bug :)

NicotineLL avatar Dec 18 '15 13:12 NicotineLL

Sure, I'll look at pushing up a fix when I get some time.

tomhallam avatar Dec 18 '15 14:12 tomhallam