我需要取EndOfSource.
和EndOfMessage.
之间的所有字符串行。你知道吗
例如,如果输出为:
8019 Warning Microsoft-Windows-DNS-Client **EndOfSource.** The system failed to register host (A or AAAA) resource records (RRs) for network adapter
with settings:
Adapter Name : {B50403AE-8D65-4933-9E8E-7149657E41CD}
Host Name : l-reg-8128
Primary Domain Suffix : mtl.labs.mlnx
DNS server list :
10.7.77.135, 10.4.0.121
Sent update to server : <?>
IP Address(es) :
fdfd:fdfd:7:36:2e0:81ff:fe33:92ad, 10.7.38.128
The reason the system could not register these RRs was because of a security related problem. The cause of this could be (a) your computer does not have permissions to register and update the specific DNS domain name set for this adapter, or (b) there might have been a problem negotiating valid credentials with the DNS server during the processing of the update request.
You can manually retry DNS registration of the network adapter and its settings by typing 'ipconfig /registerdns' at the command prompt. If problems still persist, contact your DNS server or network systems administrator. See event details for specific error code information. **EndOfMessage.**
我尝试以下代码:
import re
re.findall("EndOfSource. (.*) EndOfMessage.", output)
这里有几个问题:
.*
是一个贪婪的子模式,当您需要懒惰的子模式时,请使用.*?
.
与换行符不匹配,需要使用re.S
或re.DOTALL
启用点对点模式使用
相关问题 更多 >
编程相关推荐