Home >Backend Development >PHP Tutorial > 如上,小弟我是想要结果为 12abc34

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

WBOY
WBOYOriginal
2016-06-13 13:44:06753browse

如上,我是想要结果为 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);
试试这个

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn