Syntax Syntax
Source Source
File: wp-includes/class-snoopy.php
function _striplinks($document) { preg_match_all("'<\s*a\s.*?href\s*=\s* # find <a href= ([\"\'])? # find single or double quote (?(1) (.*?)\\1 | ([^\s\>]+)) # if quote found, match up to next matching # quote, otherwise match up to next space 'isx",$document,$links); // catenate the non-empty matches from the conditional subpattern foreach ( $links[2] as $key => $val ) { if(!empty($val)) $match[] = $val; } foreach ( $links[3] as $key => $val ) { if(!empty($val)) $match[] = $val; } // return the links return $match; }