title: Most reliable way to extract strings between two delimiters
body: <p>I've tried multiple functions to extract whatever between two strings, The delimiters might contain special characters, I guess that's why none worked for me.</p>
  
  <p>My current function:</p>
  
  <pre><code>function between($str, $startTag, $endTag){
      $delimiter = '#';
      $regex = $delimiter . preg_quote($startTag, $delimiter) 
                          . '(.*?)' 
                          . preg_quote($endTag, $delimiter) 
                          . $delimiter 
                          . 's';
      preg_match($regex, $str, $matches);
      return $matches;
  }
  </code></pre>
  
  <p>Example of string:</p>
  
  <pre><code>#{ST@RT}#
  Text i want
  #{END}#
  
  #{ST@RT}#
  Second text i want
  #{END}#
  </code></pre>
  
  <p>How to improve that or suggest another solution to:</p>
  
  <ul>
  <li>Support any kind of character or new lines</li>
  <li>Extract multiple strings if found</li>
  </ul>
  
  <hr>
  
  <p><em><strong>Current Behavior:</strong> Only returns the first match, And also returns the match plus the surrounding tags which is unwanted</em></p>