fork download
  1. import re
  2. sample="""[2019-01-02 16:15:17.882][P:1624/T:1420][UIPCall.cpp:743
  3. CUIPCall::HandleUICEvent()][Enter]
  4. [2019-01-02 16:15:17.883][P:1624/T:1420][UIPCallState.cpp:1776
  5. CUIPCallIncomingLine1State::HandleUICEvent()][Enter]"""
  6. pattern=r'\[(.*?)\]\[(.*?)\]\[(.+?)(HandleUICEvent|FastNtfClosed_Line1_Common|Login|Logout)\(\)\]\[(.*?)\]$'
  7.  
  8. p = re.compile(pattern, re.MULTILINE | re.DOTALL)
  9.  
  10. print([(x.start(), x.end()) for x in p.finditer(sample)])
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
[(0, 92), (93, 209)]