fork download
  1. import re
  2.  
  3. text = """[2018-01-20 05:19:54.812] INFO com.mulesoft.ch.monitoring.MonitoringCoreExtension [qtp689806602-32]: Monitoring enabled: true
  4. [2018-01-20 05:19:54.813] INFO com.mulesoft.ch.monitoring.MonitoringCoreExtension [qtp689806602-32]: Registering ping flow injector...
  5. [2018-01-20 05:19:54.833] INFO com.mulesoft.ch.queue.boot.PersistentQueueCoreExtension [qtp689806602-32]: The PersistentQueueManager is NOT configured. The normal VM queue manager will be used.
  6. [2018-01-20 05:19:54.841] INFO org.mule.lifecycle.AbstractLifecycleManager [qtp689806602-32]: Initialising RegistryBroker
  7. [2018-01-20 05:19:54.872] INFO
  8. [2018-01-24 02:14:30.153] INFO org.mule.routing.SynchronousUntilSuccessfulProcessingStrategy [[swt-fastsalescomp-anaplan-schedules].ScatterGatherWorkManager.24]: Exception thrown inside until-successful org.mule.module.http.internal.request.ResponseValidatorException: Response code 503 mapped as failure."""
  9.  
  10. for match in re.finditer(r'\d{4}(?:-\d{2}){2}[^]]+|(?<=Response code )(?P<code>\d+)', text):
  11. print(match.group())
Success #stdin #stdout 0.08s 64488KB
stdin
Standard input is empty
stdout
2018-01-20 05:19:54.812
2018-01-20 05:19:54.813
2018-01-20 05:19:54.833
2018-01-20 05:19:54.841
2018-01-20 05:19:54.872
2018-01-24 02:14:30.153
503