title: Logic App - Expression to get a particular substring from a string
body: <p>I have below JSON input in my Logic App:</p>
  <pre><code>{
     &quot;d&quot;:{
        &quot;results&quot;:[
           {
              &quot;userId&quot;:&quot;123&quot;,
              &quot;payGrade&quot;:&quot;KF15-314-370-AGR342-PD1&quot;
           },
           {
              &quot;userId&quot;:&quot;456&quot;,
              &quot;payGrade&quot;:&quot;KF14-269-313-AGR291-R4&quot;
           },
           {
              &quot;userId&quot;:&quot;789&quot;,
              &quot;payGrade&quot;:&quot;KF14-269-313-AGR289&quot;
           }
        ]
     }
  }
  </code></pre>
  <p>I want to use only a last part/substring after <strong>&quot;AGR-&quot;</strong> from <strong>&quot;payGrade&quot;</strong>
  (i.e. <strong>&quot;PD1&quot;</strong> from <strong>&quot;KF15-314-370-AGR342-PD1&quot;</strong> | <strong>&quot;R4&quot;</strong> from <strong>&quot;KF14-269-313-AGR291-R4&quot;</strong> | and if there's nothing after &quot;AGR&quot; just make it blank)</p>
  <p>I've been looking at &quot;substring('text', startIndex, length)&quot; expression function but it only returns substring from a particular position/index so not sure how to achieve this.</p>