h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
583 stars 85 forks source link

Regular expression not supported in jsonpath array value matching #15

Closed aiceball closed 1 month ago

aiceball commented 6 years ago

I believe that the =~ syntax is something Jayway uses, but was unable to find any json filter regex matching when using jsonpath-ng parse function.

when trying to use variable[?(@.parameter =~ 'regex')] I obtain the following error:

jsonpath_ng.lexer.JsonPathLexerError: Error on line 1, col 63: Unexpected character: ~

dlacher1 commented 5 years ago

https://github.com/dlacher1/jsonpath-ng ^^^ this branch has this supported the syntax is $.variable[?(@.parameter ~= 'regex']

michaelmior commented 1 month ago

@aiceball You should try importing parse from jsonpath_ng.ext. If you are still having any issues, feel free to reopen.