jq: Select property value using regex
jq: Select property value using regex I have the following json Object: { "foo": { "name": "Name 1", "color": "green", "something_else": { "name" : "Name 2" } }, "bar": { "name": "Something else", "color": "red" } } To get all possible parents properties of the property called "name" using jq I tried : path(recurse|select(.name? !=""))[0] And it works and give back : "foo" "foo" "bar" Now I want to apply regex to filter the property value, say I want to consider only all properties called name that have a value beginning with "Name" and followed by a number like "Name 2" , to get: name "Name 2" "foo" "foo" I tried this: path(recurse|select(.name? =~ match(/Name */)))[0] How to use mat...