You are reading a single comment by @Gordon and its replies.
Click here to read the full conversation.
-
For my test input of 5310 chars it still crashes.
After quite a while i get this error message:Uncaught Error: Unknown escape character 117 in RegEx at line 1 col 184 ...{return a.charCodeAt(0)%10}) ^ in function "dec" called from line 2 col 229 ...)%10})};console.log(dec(img).length); ^ >
Here is the full example code to reproduce:
let img = '720/Ç66/D65/gf64/wB64/ÆAH63/+2Af63/g2A63/ÂÇAD63/PÄwP62/wPjg62/+Q/PD62/nDÆ+PÆ60/Æ+PÃÂ/j60/l2/vzÂP59/Æj/+/PAf59/kv/ÅÇwB59/Æw2/P¾AH59/lv/Æ/Bwf58/+C2/zÂfh59/wJ2/OF/H58/+Uz/ÃzÁ+f58/yfn/m/fÂ59/A/v+Gd/j58/ÃD/fÂÃÁ/P58/kÁ2/G2fÆ58/+3/ÇÅ2/Ã58/z3/k3/n58/N2/Æz2/+f57/ÆD2/h/Ç/Ã58/yf/Æj3/n58/J2/n2/f+P57/Æ2/ÆP/µ/Â58/Ã2/Àf/f/j58/n/+M2/f+P58/P/ÅÃÆL/Âf57/Æ2/OTÄH/h58/Ã/ÇcnÆ/+X58/zžÆPÅ/Ãf58/nzTÂfv/l57/A2Ph/x3/H56/wACPk/jf/Æf56/P/AOT/l2/x56/ÄP/ÂM2/f2/H56/ef/ÆD/Æ/f+f55/Å+f/jÁ/ÃÇ/Â56/v2/ÆÇP2ÁÅ/j55/Æv2/BÄ/vPn+P55/wP/Ç2x2+/PÃ55/+b2/r/zÃ/+/n55/Å2/ÇH/2nÁÇÄf55/v2/kf/O2fÅp55/+j/ÆÅ/+Z+/ÀH55/ÄP/z2/ÆnÇ/IfÂf53/oH/f2/ÂPz+BÆAP52/+H/Ã3/ÂfnÂPn/P52/z2/v3/Â/OQÆgGf52/P/+4/w+YDg/B52/Æj/Å4/xÆAMf/P52/ÄP/v4/wIAn/+f52/v/Æ5/w2Af/Ã52/+2/r/ÂA2/gAH2/z52/ÃPÇvYHÆf/gA3/P52/k+W+x2/D+AD56/P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At(0) % 10); console.log(dec(img).length);
If you try the latest build, it should work now:
It turns out it was because
String.replace
wasn't resuming the search from the correct place.