Issues with obfuscated regex matches
paambaati opened this issue · 2 comments
paambaati commented
In my code, I do a regex match for a string like this.
str.match('^\\d+$')
This gets obfuscated to -
str.match("\x5e\d\x2b\x24")
This doesn't seem to work though, as seen below -
> str="12345678901234567890";
'12345678901234567890'
> str.match('^\\d+$')
[ '12345678901234567890',
index: 0,
input: '12345678901234567890' ]
> str.match("\x5e\d\x2b\x24")
null
stephenmathieson commented
hmm looks like we're loosing characters as '\x5e\d\x2b\x24' == '^d+$'
. this is definitely a bug.
as a quick fix (on your end), just pass a RegExp
to String#match
rather than a string.
paambaati commented
@stephenmathieson Ah, that fixes my issue for now.