I have a file that looks like this:
SPECIMEN: Procedure: xxxx1 A) Location: yyyy2
Major zzz B) Location: something
text here C) more
CLINICAL DIAGNOSIS: xyz
Where the newlines are CR then LF.
I'm trying to make regex that reads from the end of Procedure: until the start of CLINICAL DIAGNOSIS but having issues reading multiple lines.
Here's what I have:
$input_file = 'c:\Path\0240188.txt'
$regex = ‘(?m)^SPECIMEN: Procedure: (.*)CLINICAL DIAGNOSIS:’
select-string -Path $input_file -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value }
Which doesn't return anything.
If I change the line to:
$regex = ‘(?m)^SPECIMEN: Procedure: (.*)’
It grabs the first line, but not the rest. I assumed (?m) was suppose to grab multiple lines for me.
Any tips?
 
     
     
     
     
     
    
