I need to find a regex to assert the presence of certain keys in a JSON object.
Example, let's say I have a JSON object like this
{"key1": {...}, "key2": [...], "key3": "some id", "key4": "irrelevant"}
I need a regex that asserts that, for example, key1, key2 and key3 are there.
Note that in a JSON the order of elements is irrelevant.
I've been searching in the web, including here on stackoverflow, and the only solution that seemed it would solve my problem was this
^(?=.*\bkey1\b)(?=.*\bkey2\b)(?=.*\bkey3\b).*$
provided here, but it's not working for me. It doesn't match anything in my JSON object.
Does anyone know why? Is there a better solution?
Thanks