5
之外的所有字
在PHP中,如何使用preg_replace
编写正则表达式,以便删除前面有空格的括号&中除“The”之外的任何短语。例如,正则表达式:匹配除
Concordia University (Anything But The) => Concordia University
American University (The) => American University (The)
是的,工作!谢谢!我还在排除的单词中添加了“UCSD”:'preg_replace('/ \((!!(The | UCSD)\))。*?\)/','',$ subject) 'preg_replace'](http://php.net/manual/en/function.preg-replace.php)以获取更多信息。 – ma11hew28 2011-03-31 16:10:29