开发者

Matching all substrings inside parentheses but those starting with blacklisted word

In PHP, using preg_replace, how do I write a regular expression so that any phrase, except "The," in pa开发者_如何学JAVArenthesis & preceded by a space is deleted. E.g.,

Concordia University (Anything But The) => Concordia University
American University (The) => American University (The)


Does preg_replace support negative lookaheads? If so you can do something like this...

\((?!The\)).*?\)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜