我试图删除低于' 15'使用preg_replace例如:
$string = '1 20 5 16 11 15 14';
我希望preg_replace之后的输出为20 16 15
怎么做:))
答案 0 :(得分:1)
使用此模式
switch0.setOn(true, animated:true)
解释
\s*\b\d\b|\b1[01234]\b
答案 1 :(得分:0)
替换范围从0
到9
或范围从10
到14
$string = '1 20 5 16 11 15 14';
var_dump(preg_replace("/\b([0-9]{1}|1[0-4]{1})\b/", "", $string));
// the output: ' 20 16 15 '