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