当前位置:Gxlcms > PHP教程 > 如上,小弟我是想要结果为12abc34

如上,小弟我是想要结果为12abc34

时间:2021-07-01 10:21:17 帮助过:11人阅读

如上,我是想要结果为 12abc34
$string = "some text (12abc34) more text";
if(preg_match("/[(][.][)]/",$string,$matches)){
echo $matches;
}
?>
如上,我是想要结果为 12abc34

------解决方案--------------------
$string = "some text (12abc34) more text";
preg_match('/\(([a-z0-9]+)\)/', $string, $matches);
echo $matches[1];
------解决方案--------------------
$string = "some text (12abc34) more text";
$preg = "/\d+.*\d+/";
preg_match($preg, $string, $matches);
var_dump($matches);
试试这个

人气教程排行