preg_replace的正则表达式

时间:2011-04-17 14:57:36

标签: php regex

你能帮我解决一下preg_replace中这个字符串更改的正则表达式吗?

从“当天,他正在玩”到“他很好玩”。

2 个答案:

答案 0 :(得分:2)

preg_replace("/On the day, he is playing/", "he is good to play", $input);

答案 1 :(得分:1)

如果要在字符串中替换最后一个逗号“,”之后的任何内容,请尝试以下操作:

preg_replace("/[^,]*$/", " he is good to play", $input, 1);
相关问题