2014年3月27日 星期四

[regex]find repeated word(patten) in string



>>> import re
>>> stra='abcd  CEF:88|TM|DD|3.2.1028|100100|MALWARE_DETECTION|8|dvchost=A2773-cav.csv-alak-20130602050822 dmac=00:15:58:C6:7C:70 ruleName=ATSE/VSAPI detected file malName=Cryp_Xed-12  OK  CEF:1|TM|DD|3.2.1028|100100|MALWARE_DETECTION|8'

>>> re.findall(r'(CEF:\d+\|((?!CEF).)*)',stra)
[('CEF:88|TM|DD|3.2.1028|100100|MALWARE_DETECTION|8|dvchost=A2773-cav.csv-alak-20130602050822 dmac=00:15:58:C6:7C:70 ruleName=ATSE/VSAPI detected file malName=Cryp_Xed-12  OK  ', ' '), ('CEF:1|TM|DD|3.2.1028|100100|MALWARE_DETECTION|8', '8')]

沒有留言:

張貼留言