时间:2021-07-01 10:21:17 帮助过:25人阅读
name1输出结果:name2 "; $patten = "/([^<]*)<\/str\d+>/isU"; preg_match_all($patten,$str,$matches); print_r($matches[1]);
------解决方案--------------------PHP code
$str = "name1 name2 "; preg_match_all('/>([^<]+)输出结果: Array ( [0] => name1 [1] => name2 ) */
------解决方案--------------------PHP code
preg_match_all("/>[^<]+",$str,$m); print_R($m[1]);输出结果:
------解决方案--------------------
$str = "name1 name2 ";
preg_match_all('/>([^<]+)print_r($matches[1]);
/**
Array ( [0] => name1 [1] => name2 )
*/
------解决方案--------------------PHP code
name1name2 "; $preg="#(.*) (.*) #"; preg_match($preg,$str,$arr); echo $arr[1]; echo $arr[2]; ?>
------解决方案--------------------
$str="name1 name2 ";
preg_match_all("/<[a-z0-9]*>([^<|>]*)<\/[a-z0-9]*>/",$str,$matches);
echo $matches[1][0];
echo $matches[1][1];
?>
------解决方案--------------------
"/>(.*?)<\//"
------解决方案--------------------