I have the below pact file with following interactions
"interactions": [
{
"description": "I call fixture service using a valid fixture Id",
"providerState": "a request to check the api response",
"request": {
"method": "get",
"path": "/api/v1.0/abc/5d550d86-fe18-44e5-93d2-817318acca3d",
"headers": {
"Accept": "application/json",
"X-Clarksons-Security-Cloud": "xxxxyyyyy"
}
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"body": {
"fixtureId": "5d550d86-fe18-44e5-93d2-817318acca3d",
"fixtureNumber": "145393-02-DR-03-18"
},
"matchingRules": {
"$.body.fixtureId": {
"match": "type"
},
"$.body.fixtureNumber": {
"match": "regex",
"regex": "[0-9]{6}-[0-9]{2}-[a-zA-Z]{2}-[0-9]{2}-[0-9]{2}"
}
}
}
}
],
There is a chance fixtureNumber
can be null. Please could you let me know a matcher that would do both check for [0-9]{6}-[0-9]{2}-[a-zA-Z]{2}-[0-9]{2}-[0-9]{2}
and also check for null.