title: How to fetch second value in string based on the matched value before the delimeter "|"?
body: <p>How to fetch second value in string based on the matched value before the delimeter &quot;|&quot;?</p>
  <p>Desired Output:</p>
  <pre><code>12348888
  113336669998888
  </code></pre>
  <p>Based on the searchfor value: <code>1254698</code></p>
  <pre><code>&lt;?php
  
          $contents = '12345|BHKAHHHHkk
  1254698|12348888
  12345|BHKNe22223366
  1254698|113336669998888
  012250000|22154545488888';
  
      $searchfor = '1254698';
      
      if(preg_match('/(?:\n|^)' . $searchfor .  '\|([^|]+)(.*?)(?:\r?\n|$)/is', $contents, $matchs))
      {
          $second_value = $matchs[1];
          $reset_values = $matchs[2];
          echo &quot;Result for searching &lt;b&gt;$searchfor&lt;/b&gt; is &lt;b&gt;$second_value&lt;/b&gt; and reset of data is &lt;b&gt;$reset_values&lt;/b&gt;&quot;;
      }
      else echo('Not Found :(');
      
      ?&gt;
  </code></pre>