tsquery
tsquery copied to clipboard
Slash escaping in attribute regex throws SyntaxError
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"
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.
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