mercredi 4 avril 2018

Regex for anything in a json

I'm using a json to mock a response in a test. The response has some fields that I cannot predict as:

"createdAt": "2018-04-04T08:27:17.716Z"

"updatedAt": "2018-04-04T08:32:38.157Z"

I've tried to use the regex */ to match anything:

"createdAt": "*/"

But it just takes it literally and the test fails. What am I missing? Is it possible to put a regex that when the tests try to compare responses stands for "anything" inside a json?

Aucun commentaire:

Enregistrer un commentaire