擅长:python、mysql、java
<p>试试这个:-</p>
<pre><code>import re
lines = ["cf-ab1", "cf-bc2", "cf-ab1-hotfix", "cf-bc2-hotfix", "cf-ab1-canary", "cf-
cd1-staging", "cf-cd1-staging2", "cf-cd1", "cf-cd1-sic-staging", "cf-cd1-sagdf-
staging"]
line_compile = re.compile('^(?!.*(ab1-canary|cd1-staging|cf-ab1-canary)).*$')
matched = []
for line in lines:
if line_compile.match(line):
matched.append(line)
</code></pre>