Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在文本文件中查找大写的短语。
我想出了一个正则表达式,它可以捕获像“New Lender”这样的短语:
(?:[A-Z][A-z]+(?:\x20+|\,|\.|\:|\;|\r|\n|\t|\x29|\x22|\x2D|\x26))+
但我对像"Bank of England". 很少有非大写的单词会出现(of|and|or),但我正在努力让正则表达式匹配得更远"Bank of"。谁能指出我正确的方向?
"Bank of England"
(of|and|or)
"Bank of"
提前致谢。
尝试这个:
(?:\b([A-Z]\w+)\b(?:\s|of|and|or)*)+