Closed arrterian closed 5 years ago
The library has a problem with escaping backslashes
In code we have: v.replace (/\\/g, '\\')
v.replace (/\\/g, '\\')
Its mean: please replace each one backslash with one backslash Because JS has following rules for backslashes in strings and regular expressions
\ — always escapes the next character \\ — always mean one backslash
\
\\
So for replacing one backslash with two backslashes, we need double this one in second parameters of replace function
v.replace (/\\/g, '\\') -> v.replace (/\\/g, '\\\\')
Fixed in PR #15
Merged
The library has a problem with escaping backslashes
In code we have:
v.replace (/\\/g, '\\')
Its mean: please replace each one backslash with one backslash Because JS has following rules for backslashes in strings and regular expressions
\
— always escapes the next character\\
— always mean one backslashSo for replacing one backslash with two backslashes, we need double this one in second parameters of replace function
v.replace (/\\/g, '\\') -> v.replace (/\\/g, '\\\\')