Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current node regex filter seems to be failing with recursive descent #159

Open
arcivanov opened this issue Jan 11, 2024 · 0 comments
Open

Comments

@arcivanov
Copy link

arcivanov commented Jan 11, 2024

        from jsonpath_ng.ext import parse
        from pprint import pprint
        datum = {
            "a": "x",
            "array": [
                {"bcde": "y"}
            ]
        }
        pprint(parse('$..*').find(datum))
        pprint(parse('$..*[?@ =~ "a"]').find(datum))
        pprint(parse('$..*[?@ =~ "b.*"]').find(datum))

Results:

[DatumInContext(value='x', path=Fields('a'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None)),
 DatumInContext(value=[{'bcde': 'y'}], path=Fields('array'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None)),
 DatumInContext(value='y', path=Fields('bcde'), context=DatumInContext(value={'bcde': 'y'}, path=Index(index=0), context=DatumInContext(value=[{'bcde': 'y'}], path=Fields('array'), context=DatumInContext(value={'a': 'x', 'array': [{'bcde': 'y'}]}, path=Root(), context=None))))]
[]
[]

Expected results would include a and array in the second query and bcde in the third.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant