<?php
$str = "请注意:有谁知道30901.5号路怎么走?这个因为我买了100块的烧饼和7901的钥匙了,那个对了,我再拿个30000";
$pattern = '/(\d+\.?\d+)/';
//$pattern = '/(\d+)\.?(\d+)/';
// $str = "42.234 EUR 53.218 AUD CAD97.164 311.151 MYR 125.042 NZD GBP84.270 SGD60.227 USD134.400";
if(preg_match_all($pattern, $str, $match)){
echo '<pre>';
print_r($match);
}else{
echo '没有找到!';
}
?>
结果
Array
(
[0] => Array
(
[0] => 30901
[1] => 100
[2] => 7901
[3] => 30000
)
[1] => Array
(
[0] => 30901
[1] => 100
[2] => 7901
[3] => 30000
)
)
评论
本文评论功能已关闭。