Need help with a regex to select multiple lines. From what I have so far it works until I put the last regex in. Once I do that, it skips over the middle one. Passwords have been removed for security purposes.
My Goals
- Select all lines beginning at Current configuration ending at version, "or the ! right before it"
- Select all lines with "secret"
- Select all lines with "password"
My Regex
(?s)Current configuration (.*)NVRAM|secret 5 +(\S+)|password 7 +(\S+)
EDIT: took about spaces before and after the | and it seems to highlight what i want. It doesn't do the entire line though.
Test Data
Building configuration...
Current configuration : 45617 bytes
!
! Last configuration change at 00:22:36 UTC Sun Jan 22 2017 by user
! NVRAM config last updated at 00:22:43 UTC Sun Jan 22 2017 by user
!
version 15.0
no service pad
!
no logging console
enable secret 5 ***encrypted password***
!
username admin privilege 15 password 7 ***encrypted password***
username sadmin privilege 15 secret 5 ***encrypted password***
aaa new-model
!
ip ftp username ***encrypted password***
ip ftp password 7 ***encrypted password***
ip ssh version 2
!
line con 0
password 7 ***encrypted password***
login authentication maint
line vty 0 4
password 7 ***encrypted password***
length 0
transport input ssh
line vty 5 15
password 7 ***encrypted password***
transport input ssh
!
Desired Result:
Building configuration...
!
version 15.0
no service pad
!
no logging console
enable
!
username admin privilege 15
username gisadmin privilege 15
aaa new-model
!
ip ftp username cfgftp
ip ftp
ip ssh version 2
!
line con 0
login authentication maint
line vty 0 4
length 0
transport input ssh
line vty 5 15
transport input ssh
!
(.*)with(.*?)