regex preg_replace php

问题描述 投票:1回答:1

我有随机变量,例如:剥离@ 489.000带1 @ 489.000带2 @ 589.000

我需要的输出将是:“ @ @ 489.000后面的唯一数字”>

所以给我输出:489.000489.000589.000

热衷于使用php正则表达式?

$string = '  Strip 1 @ 489.000'; $pattern = ' /(\s\S) @ (\d+)/i'; $replacement = '$3'; echo preg_replace($pattern, $replacement, $string);

我有随机变量,例如:条带@ 489.000条带1 @ 489.000条带2 @ 589.000我需要输出的是:仅'anything @'489.000之后的数字,所以给我输出:489.000 489.000 589.000热到...

php regex preg-replace
1个回答
1
投票

要获取所有匹配项,请使用

© www.soinside.com 2019 - 2024. All rights reserved.