正则表达式匹配以html换行符结尾的组

时间:2017-10-25 18:25:44

标签: python regex

我有下面的文字,我在python正则表达式中匹配组1,2和3就好了,直到我想匹配's'在'srcuser:'和html换行符之间。我的正则表达式是 seqno :( \ d +)。+?src:(\ d {1,3}。\ d {1,3}。\ d {1,3}。\ d {1,3}) 。+?dst:(\ d {1,3}。\ d {1,3}。\ d {1,3}。\ d {1,3})。+?srcuser:(。+)?[html打破她]

domain: 1<br/>receive_time: 2017/10/25 13:47:19<br/>serial: 00790100000<br/>seqno: 7198725<br/>actionflags: 0x0<br/>type: THREAT<br/>subtype: spyware<br/>config_ver: 1<br/>time_generated: 2017/10/25 13:47:19<br/>src: 1.1.1.1<br/>dst: 2.2.2.2<br/>natsrc: 1.1.1.1<br/>natdst: 2.2.2.2<br/>rule: to INTERNET<br/>srcuser: me<br/>blabla

请告知

1 个答案:

答案 0 :(得分:0)

您可以尝试:

seqno: (\d+).+?src: (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}).+?dst: (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}).+?srcuser: (.+)?<br\/>

Demo