Sample JSON body from an http request,
[
{
"date-range": {
"high": "2020-09-15",
"low": "2020-09-13T18:30"
},
"visit-identifiers": {
"system-id": 4,
"compound-id": "1196_AFG_2_4"
},
"study-site": {
"study": {
"system-id": 1196,
"study-protocol-version": "TEST TRIAL 01"
},
"timezone": {
"code": "Asia\/Calcutta",
"display-name": "(GMT+5:30) Bombay, Calcutta, Madras, Mumbai, New Delhi"
},
"organization": {
"system-id": 8,
"primary-centre-short-name": "(RNSH) - Kolling Institute of"
},
"study-country": {
"country-code": "AFG",
"display-name": "Afganasthan"
},
"study-site-identifiers": {
"system-id": 2,
"long-display-id": "Mr Perf_HYD_ClinPersonnel Test",
"site-reference": "2",
"short-display-id": 2
}
},
"defined-activity": {
"display-name": "NOV-Monitoring",
"visit-type": "MON"
},
"primary-investigator": {
"title-prefix": "Mr.",
"system-id": 27,
"display-name": "Mr. Clinical Mr Perf_HYD_ClinPersonnel Test",
"voice-telecom-address": "Duplicate 1",
"title-suffix": "Test",
"email-telecom-address": "[email protected]",
"given-name": "Clinical ",
"middle-name": "",
"family-name": "Mr Perf_HYD_ClinPersonnel"
},
"status": {
"code": "ON",
"display-name": "Ongoing"
}
},
{
"date-range": {
"high": "2020-06-05",
"low": "2020-06-05"
},
"visit-identifiers": {
"system-id": 5,
"compound-id": "1196_AFG_2_5"
},
"study-site": {
"study": {
"system-id": 1196,
"study-protocol-version": "TEST TRIAL 01"
},
"organization": {
"system-id": 8,
"primary-centre-short-name": "(RNSH) - Kolling Institute of"
},
"study-country": {
"country-code": "AFG",
"display-name": "Afganasthan"
},
"study-site-identifiers": {
"system-id": 2,
"long-display-id": "DISP_ID_1",
"site-reference": "2",
"short-display-id": 2
}
},
"defined-activity": {
"display-name": "NOV-Monitoring",
"visit-type": "MON"
},
"primary-investigator": {
"title-prefix": "Mr.",
"system-id": 27,
"display-name": "TEST NAME",
"voice-telecom-address": "Duplicate 1",
"title-suffix": "Test",
"email-telecom-address": "[email protected]",
"given-name": "Clinical ",
"middle-name": "Test",
"family-name": "Mr Perf_HYD_ClinPersonnel"
},
"status": {
"code": "PL",
"display-name": "Planned"
}
},
{
"date-range": {
"high": "2020-06-06",
"low": "2020-06-06"
},
"visit-identifiers": {
"system-id": 6,
"compound-id": "1196_AFG_2_6"
},
"study-site": {
"study": {
"system-id": 1196,
"study-protocol-version": "TEST TRIAL 01"
},
"timezone": {
"code": "Pacific\/Midway",
"display-name": "(GMT-11:00) Midway Is, Samao"
},
"organization": {
"system-id": 8,
"primary-centre-short-name": "(RNSH) - Kolling Institute of"
},
"study-country": {
"country-code": "AFG",
"display-name": "Afganasthan"
},
"study-site-identifiers": {
"system-id": 2,
"long-display-id": DISP_ID_1",
"site-reference": "2",
"short-display-id": 2
}
},
"defined-activity": {
"display-name": "NOV-Contact Visit",
"visit-type": "CTT"
},
"primary-investigator": {
"title-prefix": "Mr.",
"system-id": 27,
"display-name": "TEST NAME",
"voice-telecom-address": "Duplicate 1",
"title-suffix": "Test",
"email-telecom-address": "[email protected]",
"given-name": "Clinical ",
"middle-name": "Test",
"family-name": "Mr Perf_HYD_ClinPersonnel"
},
"status": {
"code": "PL",
"display-name": "Planned"
}
}
]
from the above JSON response data I want to fetch the compound ID which has status code "PL". In the above JSON have 3 compound id,
"compound-id": "1196_AFG_2_4" -- "code": "ON"
"compound-id": "1196_AFG_2_5" -- "code": "PL"
"compound-id": "1196_AFG_2_6" -- "code": "PL"
Want to select any one from the above which has status code PL. Currently I am using
Regex: "compound-id":"(.+?)"
Template: $1$
match No: 0
Is there any way we can put a condition in regex?
