JsonPath-PHP icon indicating copy to clipboard operation
JsonPath-PHP copied to clipboard

Allow filter keys with a regex match

Open drugan opened this issue 2 years ago • 3 comments

Allows to apply a regular expression on a key instead of value. So you can get area only of the room entries of the house:

$.house[?(/roo.*/)][area]

https://extendsclass.com/jsonpath-tester.html

drugan avatar Jun 30 '22 09:06 drugan

Hello @drugan, thanks for the pull request! Sorry for the delay :sweat_smile:

It looks great!

Could you add at least one test case for it and add it to the JsonPath Language section in the readme?

With that in place I'll merge this and we can have this feature in a release!

Galbar avatar Jul 26 '22 11:07 Galbar

Hi @Galbar,

Yes, I do it as soon as possible.

drugan avatar Jul 26 '22 13:07 drugan

@Galbar

Done. I've also added the PCRE i and x modifiers which makes writing regex patterns a little easier:

https://www.php.net/manual/en/reference.pcre.pattern.modifiers.php

drugan avatar Aug 02 '22 06:08 drugan