我有一个字符串可能会随着时间的推移变大。我需要找出字符串中的工件路径。有没有办法使用正则表达式突出显示所有工件路径?我有块引用它们。对于这种场景,雷鬼会是什么样的?
/usr/lib64/python2.6/site-packages/Crypto/Util/number.py:57: PowmInsecureWarning: Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.
_warn("Not using mpz_powm_sec. You should rebuild using libgmp >= 5 to avoid timing attack vulnerability.", PowmInsecureWarning)
[SSH] exit-status: 0
For pattern: *.py 10 artifacts were found
For pattern: *.md 1 artifacts were found
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/elb_ec2Connector.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/elb_ec2Connector_Tony.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_weekend_stop.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_4th_box.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/startontags.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/nitish.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/krishna.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_weekend.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/get-pip.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/startup_script.py
Deploying artifact: artifactory/artifactory/yum-local/test/test2/test3/test4/test5/test6/README.m
Deploying build info to: artifactory/artifactory/api/build
Collecting metadata...
Metadata collection done.
以上所有内容都是字符串,我需要找到一种方法来从中得到以下部分:
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/elb_ec2Connector.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/elb_ec2Connector_Tony.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_weekend_stop.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_4th_box.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/startontags.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/nitish.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/krishna.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/naren_weekend.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/get-pip.py
Deploying artifact: artifactory/artifactory/yum-local/test/test4/test5/startup_script.py
Deploying artifact: artifactory/artifactory/yum-local/test/test2/test3/test4/test5/test6/README.m
请记住,路径可能会不断更改其他字符串,但初始单词部署工件将保持不变,并且所有路径将一起显示在日志中...
答案 0 :(得分:1)
似乎很容易。
artifact_paths = re.findall(r"^Deploying artifact: .*$", full_string, re.M)