fork download
  1. <?php
  2.  
  3. $text = 'Title: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  4. Snippet: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  5. Category: Lorem ipsum dolor sit amet, consectetur adipiscing elit.';
  6.  
  7. $line = preg_match('~(*BSR_ANYCRLF)(^Snippet:.*$)~m', $text, $matches) ? $matches[1] : NULL;
  8. echo $line;
Success #stdin #stdout 0.02s 13112KB
stdin
Title: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Snippet: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Category: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
stdout
Snippet: Lorem ipsum dolor sit amet, consectetur adipiscing elit.