【发布时间】:2013-04-19 16:57:18
【问题描述】:
有一篇长文,我只想去掉thousand separator,不是逗号。
$str = "Last month's income is 1,022 yuan, not too bad.";
//=>Last month's income is 1022 yuan, not too bad.
preg_replace('#(\d)\,(\d)#i','???',$str);
如何编写正则表达式模式?谢谢
【问题讨论】:
-
请注意,如果用户在列表中犯了一个愚蠢的错误,您可能会遇到问题:
He did it 1,2 and 3 times(缺少空格 - 它会变成 12 和 3 次)。