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

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

WBOY
Release: 2016-06-13 10:06:58
Original
994 people have browsed it

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template