【发布时间】:2012-03-02 09:47:55
【问题描述】:
考虑以下字符串:
I have been driving to {Palm.!.Beach:100} and it . was . great!!
我使用以下正则表达式删除所有标点符号:
$string preg_replace('/[^a-zA-Z ]+/', '', $string);
这个输出:
I have been driving to PalmBeach and it was great!!
但我需要正则表达式始终忽略 { 和 } 之间的任何内容。所以期望的输出是:
I have been driving to {Palm.!.Beach:100} and it was great
如何让正则表达式忽略 { 和 } 之间的内容?
【问题讨论】: