Posted By

jnbn on 10/11/09


Tagged

phpregular expressionregexp


Versions (?)

Matching a XML/HTML tag


 / Published in: PHP
 

  1. function get_tag( $tag, $xml ) {
  2. $tag = preg_quote($tag);
  3. preg_match_all('{<'.$tag.'[^>]*>(.*?)</'.$tag.'>.'}',
  4. $xml,
  5. $matches,
  6. PREG_PATTERN_ORDER);
  7.  
  8. return $matches[1];
  9. }

Report this snippet  

You need to login to post a comment.