h2non / jsonpath-ng

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

Unable to pass regex in jsonpath #53

Open najmastar8 opened 4 years ago

najmastar8 commented 4 years ago

Hi,

I'm unable to pass the regex in the parse as follows jsonpath_expr = parse("$..entries[?@.name =~ /Mani/i]")

getting the following error raise Exception('Parse error at %s:%s near token %s (%s)' % (t.lineno, t.col, t.value, t.type)) Exception: Parse error at 1:22 near token / (SORT_DIRECTION)

my json looks like this image

FireHawken commented 4 years ago

Hi @najmastar8, your expression has special characters, so it should be enclosed in quotes. This should work: jsonpath_expr = parse("$..entries[?@.name =~/Mani/i]")

jkamcc commented 2 years ago

Hi @najmastar8, your expression has special characters, so it should be enclosed in quotes. This should work: jsonpath_expr = parse("$..entries[?@.name =~/Mani/i]")

Didn't work for the extend module, same error as the the opened ticket