fork download
  1. <?php
  2.  
  3. $content = 'Hello I am Tom and I am <blockquote class="quotedText">another Tom inside a quote</blockquote>';
  4.  
  5. $pattern = '#Tom#';
  6. $matches = array();
  7. preg_match_all($pattern, $content, $matches);
  8.  
  9. var_dump($matches);
  10.  
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(3) "Tom"
    [1]=>
    string(3) "Tom"
  }
}