Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以将字符串字符的结尾放在这样的范围内:
$string=preg_replace('/([a-z])([ \,$])/','$2',$string);
所以它匹配任何小写字母,然后是空格、逗号或字符串结尾?
您可以使用替代方法:
([ ,]|$)
如果您$在字符类中使用,则它仅匹配文字美元符号。
$