![](/img/trans.png)
[英]How can we replace all the matching special characters in the string except the first one?
[英]Replace all characters except first one and whitespaces
嗨,我尝试做类似的事情:
我有一些东西'Hello World!'
例如。 我想替换其中的所有字符,但第一个和空白除外。
所以...结果将是: "H.... ......"
; 我不想删除它,只是将其替换为"."
或其他字符。
我尝试使用preg_replace
进行此操作,但没有结果。
preg_replace('/(?<!^)\S/', '.', $s)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.