My powershell script doesn't seems to work to extract the data between multiple keywords spread across various lines. I want to select all the lines after NAME1 till NAME2..6 appears.So all the data between NAME1 & NAME2/3/4/5/6. The keyword NAME1 appears in the file multiple times so does other keywords. The regex however works but i am unable to figure out the mistake or the approach that i am taking when i use the regex in powershell script.
(Get-Content .\withoutStar.txt | Where-Object {$_ -match '(?is)(?<=\NAME1\b).*?(?=\bNAME2\b|\bNAME3\b|NAME4|NAME5|NAME6\b)'}) | Set-Content .\AllfunctionGroup.txt
The sample data and regex can be tested here.Sample data and regex
Can anyone throw light on this what is missing in my script.