fork download
  1. import re
  2.  
  3. s = """wgb-car1# show startup-config
  4. Using 6149 out of 32768 bytes
  5. !
  6. ! NVRAM config last updated at 15:50:05 UTC Wed Oct 1 2014 by user
  7. !
  8. version 12.4
  9. no service pad
  10. service timestamps debug datetime msec
  11. service timestamps log datetime msec
  12. service password-encryption
  13. !"""
  14. r = r"(?s)#\sshow\s*(.*?)version\s*([\d.]+)"
  15. o = [m.group() for m in re.finditer(r, s)]
  16. print o
Success #stdin #stdout 0.01s 23304KB
stdin
Standard input is empty
stdout
['# show startup-config\nUsing 6149 out of 32768 bytes\n!\n! NVRAM config last updated at 15:50:05 UTC Wed Oct 1 2014 by user\n!\nversion 12.4']