0
在下面的字符串,我需要使用re.findall为“(任何一天)”,那么它打印高达分隔符“”前搜索高达分隔符使用正则表达式
rr='PU3lserver1^server2|ABAP|Revisions|true|null|Weekend
only,ATN|server3|ABAP|Revisions|true|null|1:00 AM to 3:00 AM CET (any
day),B4P|server4^server5|ABAP|Revisions|true|Generic AFL|8:00 PM to 3:00 AM
CET (any day),C8B|server6|ABAP|Revisions|true|Generic AFL|8:00 PM to 3:00 AM
CET (any day),QU8|testserver|ABAP|Revisions|true|null|1:00 AM to 3:00 AM CET
(any day),S77|testserver|ABAP|Revisions|true|null|Weekend only'
作品以及预期:
re.findall(r'[^\s,]+Weekend\s\bonly' ,rr, re.M)
不能按预期工作:
re.findall(r'[\s,]+\(any\s\bday\)' ,rr, re.M)
任何帮助或建议,我要去的地方错了。
是不需要的'多line'模式改性剂任一。 – hwnd
@hwnd我同意你的意见。从op的代码复制。现在更正了答案。谢谢 – nu11p01n73R
是的,不需要,我有很多其他的文件,我正在使用这个sting来获取数据。 完全同意此处不需要的多行 – Deepak