I have text below and I am matching group 1,2, and 3 in python regex just fine until I want to match 'me' which is between 'srcuser: ' and html line break tag. my regex is 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 line break her]
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
Please advise
)?\s*(\w+):\s*(.*?(?=\s*
|$))`. This prevents hardcoding of specific values. Use your code to determine which values you actually require based on group 1's values. – ctwheels Oct 25 '17 at 18:38