Heim >Backend-Entwicklung >PHP-Tutorial > 如上,小弟我是想要结果为 12abc34

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:44:06768Durchsuche

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel: 如何嵌套 Nächster Artikel: 表单中复选框数据怎么插入数据库