I need a regular expression that will find me the following text:
"postmaster"="infonl@bostik.com"
"info"="infonl@bostik.com"
"nobody"="root"
from an input like:
[HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Domains\bostik.nl\Users\_aliases]
"postmaster"="infonl@bostik.com"
"info"="infonl@bostik.com"
"nobody"="root"
[HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Domains\bostikfindley.nl]
So I want it to grab everything from \_alisases] until the '[' from the next [HKEY_LOCAL_MACHINE if that’s possible. I will use this to output all the variable texts under this node in a text search program.
It’s a big file with 18000 lines where I will search in using text search. There are also line which don’t include the _aliases] they shouldn’t be returned as valid.
Example:
[HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Domains\bostik.nl\Users\_aliases]
"postmaster"="infonl@bostik.com"
"info"="infonl@bostik.com"
"nobody"="root"
[HKEY_LOCAL_MACHINE\SOFTWARE\Ipswitch\IMail\Domains\bostikfindley.nl]
"Address"="$virtual291"
"TopDir"="D:\\IMail\\bostikfindley_nl"
"Flags"=dword:00000000
"NotifyAddress"=""
"SubMailboxCreate"=dword:00000000
"NotifyPercent"=dword:00000000
"MaxOutboundSize"=dword:00000000
"VirusScan"=dword:00000001
"MaxSize"=dword:00000000
"MaxMsgs"=dword:00000000
"MaxRcv"=dword:00000000
"MaxUsers"=dword:00000000
"UserCount"=dword:00000001
"EnableSSL"=dword:00000001
"ForceSSL"=dword:00000000
"IcalEnable"=dword:00000001
I want only to be returned:
"postmaster"="infonl@bostik.com"
"info"="infonl@bostik.com"
"nobody"="root"
This does have to be a regex i can use in Search and Replace tool to find the information I need.
As you didn’t specified a programming language, here is a Perl script that do the job:
output