tsquery icon indicating copy to clipboard operation
tsquery copied to clipboard

Slash escaping in attribute regex throws SyntaxError

Open yrtimiD opened this issue 6 years ago • 2 comments

Trying to use a query: StringLiteral[text=/\/aaa/] to find a line like: var s = "/aaa"; Fails with: "SyntaxError: Invalid regular expression: //: \ at end of pattern"

yrtimiD avatar Feb 06 '20 09:02 yrtimiD

I'm having the same issue. Looks like \x2F works as a workaround instead, just remember to escape it for the string it's in.

andyrooger avatar Apr 12 '20 15:04 andyrooger

Unfortunately this one looks like it's an issue in the query parser which comes from esquery, as I can reproduce it here: http://estools.github.io/esquery/

They have an issue here and are looking for PRs: https://github.com/estools/esquery/issues/68

phenomnomnominal avatar Apr 14 '20 01:04 phenomnomnominal