<p>我认为您的regex是不正确的,要匹配包含三个或三个以上字符的所有大写单词的所有条目,您应该在<code>re.search</code>中使用类似的内容:</p>
<pre><code>regex = re.compile(r'\b[A-Z]{3,}\b')
</code></pre>
<p>使用它,您可以使用列表理解或内置函数<code>filter</code>进行筛选:</p>
<pre><code>full = ['Organization name} ', '&gt; (777) 777-7777} ', ' class="lsn-mB6 adr"&gt;1 Address, MA 02114 } ', ' class="lsn-serpListRadius lsn-fr"&gt;.2 Miles} MORE INFO YOUR LISTING MAP if (typeof(serps) !== \'undefined\') serps.arrArticleIds.push(\'4603114\'); ', 'Other organization} ', '&gt; (555) 555-5555} ', ' class="lsn-mB6 adr"&gt;301 Address, MA 02121 } ', ' class="lsn-serpListRadius lsn-fr"&gt;.2 Miles} MORE INFO CLAIM YOUR LISTING MAP if (typeof(serps) !== \'undefined\') serps.arrArticleIds.push(\'4715945\'); ', 'Organization} ']
regex = re.compile(r'\b[A-Z]{3,}\b')
# use only one of the following lines, whichever you prefer
filtered = filter(lambda i: not regex.search(i), full)
filtered = [i for i in full if not regex.search(i)]
</code></pre>
<p>结果如下所示(我认为这正是您要寻找的:</p>
<pre><code>>>> pprint.pprint(filtered)
['Organization name} ',
'&gt; (777) 777-7777} ',
' class="lsn-mB6 adr"&gt;1 Address, MA 02114 } ',
'Other organization} ',
'&gt; (555) 555-5555} ',
' class="lsn-mB6 adr"&gt;301 Address, MA 02121 } ',
'Organization} ']
</code></pre>