Syntax Syntax
Source Source
File: wp-admin/includes/class-ftp.php
function glob_pattern_match($pattern,$string) { $out=null; $chunks=explode(';',$pattern); foreach($chunks as $pattern) { $escape=array('$','^','.','{','}','(',')','[',']','|'); while(strpos($pattern,'**')!==false) $pattern=str_replace('**','*',$pattern); foreach($escape as $probe) $pattern=str_replace($probe,"\\$probe",$pattern); $pattern=str_replace('?*','*', str_replace('*?','*', str_replace('*',".*", str_replace('?','.{1,1}',$pattern)))); $out[]=$pattern; } if(count($out)==1) return($this->glob_regexp("^$out[0]$",$string)); else { foreach($out as $tester) if($this->my_regexp("^$tester$",$string)) return true; } return false; }