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