[PHP] php使用正则表达式
2016-03-03 本文已影响6人
何幻
$pattern="/^.*\/(.+?)$/";
$matchCount=preg_match($pattern,$filePath,$matches);
$fileName=$matches[1];
<u></u>preg_match
方法只进行一次匹配,返回匹配的数量(0或1)。
$pattern="/^.*\/(.+?)$/";
$matchCount=preg_match($pattern,$filePath,$matches);
$fileName=$matches[1];
<u></u>preg_match
方法只进行一次匹配,返回匹配的数量(0或1)。