Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Unable to search keys containing '-' character : solution #50

Open
IntelliDust opened this issue Feb 10, 2020 · 2 comments
Open

Unable to search keys containing '-' character : solution #50

IntelliDust opened this issue Feb 10, 2020 · 2 comments

Comments

@IntelliDust
Copy link

For example:

$result = (new JSONPath($data))->find('$..neighbor[?(@.neighbor-id == "192.168.1.1")]');

ends with:
PHP Fatal error: Uncaught Exception: Malformed filter query

after I replaced in QueryMatchFilter

@(\.(?<key>\w+)|\[["\']?(?<keySquare>.*?)["\']?\])
by
@(\.(?<key>\S+)|\[["\']?(?<keySquare>.*?)["\']?\])

Working like charm

@fredsted
Copy link

This also works for me to allow searching fields with periods (.) in them, thanks!

@martinssipenko
Copy link
Contributor

This project is now marked as abandoned and suggests using softcreatr/jsonpath as a replacement. If you think this issue is still relevant please open a new ticket under the new project.

https://github.com/SoftCreatR/JSONPath

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

No branches or pull requests

3 participants