仅从php

时间:2015-10-05 14:34:25

标签: php regex

下面是我的PHP字符串

$string = '"2015-10-04","Answer","Kumma","wikia","Kumm","890, 609","17,214","15,705", "14,538","1.93","91.23","92.57","4.00","58.15","50.88","7.27","12.50","25","0.17","11,840","81.44"';

我想从14,538,11,840等数字值中删除逗号。但它不会删除任何其他逗号请帮助我谢谢:)

2 个答案:

答案 0 :(得分:1)

使用lookarounds。

* Loads a resource in an identical manner to this request except with the dimensions of the target multiplied
* by the given size multiplier. If the thumbnail load completes before the fullsize load, the thumbnail will
* be shown. If the thumbnail load completes afer the fullsize load, the thumbnail will not be shown.

答案 1 :(得分:0)

您可以尝试preg_replace()

http://php.net/manual/en/function.preg-replace.php

$string = '"2015-10-04","Answer","Kumma","wikia","Kumm","890, 609","17,214","15,705", "14,538","1.93","91.23","92.57","4.00","58.15","50.88","7.27","12.50","25","0.17","11,840","81.44"';

preg_replace('~(?<=\d),(?=\d)~', '', $string);