tags:

views:

53

answers:

1

Sample text is as follows - it is part of a much larger document that is being parsed (each line has trailing spaces prior to its end):

                          Procedure Information                      
Primary Procedure:                                                       
LAPAROSCOPIC PARTIAL LEFT NEPHRECTOMY /ROBOTIC WITH                      
INTRAOPERATIVE ULTRASOUND                                                
Procedure Start: 5/4/2009   9:01:00AM                                    
Procedure Stop:  5/4/2009   3:29:00PM

I want to pull the "Primary Procedure" data from this string, in this case "LAPAROSCOPIC PARTIAL LEFT NEPHRECTOMY /ROBOTIC WITH INTRAOPERATIVE ULTRASOUND".

The following expression identifies the primary procedure location and manages to pull the 1st line of the value but not both lines (using the multi-line flag):

^Primary Procedure:\s*([\w\S ]*\w)\s*$

I can't figure out an expression to obtain both lines of the desired value. It is probable that this value will always be either 1 or 2 lines long. And it is also probable that we can count on the presence of the "Procedure Start:" string at the beginning of the following line.
Any help is appreciated.
Thanks.

A: 
new Regex(@"Primary Procedure:\s*(.*)\s*Procedure Start", 
  RegexOptions.Singleline).Match(str).Groups[1]
Matthew Flaschen