title: regular expression comparing a record with a previous record
body: <p>I am in need of a regular expression to search within a text file and find every row that starts with "CD" when the previous row does NOT start with "CR".</p>
  
  <p>In the sample data below, notice at the end where there are CD rows that have no preceding CR record.  I need my search to find those CD rows.</p>
  
  <pre><code>HDPM0021535 11ABC CO. D 
  CRVA MC OP-MATHER CA 1053 
  CD1010 BD5275555
  TR+00000001+00000000+0000024760 
  HDPM0021535 11ABC CO. D 
  CROMNICARE RENO 48308 9475 
  CD3055 BO9182000
  CROCR OF SANTA ROSA 48218 879 
  CD3055 BC9832555
  TR+00000002+00000000+0000000695 
  HDPM0021535 11ABC CO. D 
  CD2037 AF7944888
  CD2037 AF7944888
  TR+00000002+00000001-0000000089 
  TT+00000008+0000196660200
  </code></pre>
  
  <p>Thank you!</p>