title: Regex needs too long to fail, if there is no match
body: <p>I have the following regex string and the text string below. I have multiple nodes which I read into a string using <code>streamstreader</code>. After that I try to match using <code>regex.match()</code> to match the string, when there is a match its runs very fast even where there are numerous nodes. When there is not a match, the <code>regex.match()</code> method never stops.</p>
  
  <p>My question when the string is not a match, I just want to catch an exception. For example in the data node below lets says some fields are totally missing and in that case I am ok to catch an exception, the problem is how to stop match routine if the node format is different?  </p>
  
  <pre><code>string pat = @"TEST_REPLICATE\s*{\s*REPLICATE_ID\s*([^}]*?)\s+ASSAY_NUMBER\s*([^}]*?)\s+ASSAY_VERSION\s*([^}]*?)\s+DILUTION_ID\s*([^}]*?)\s+SAMPLE_ID\s*([^}]*?)\s+SAMPLE_TYPE\s*([^}]*?)\s+TEST_ORDER_DATE\s*([^}]*?)\s+TEST_ORDER_TIME\s*([^}]*?)\s+TEST_INITIATION_DATE\s*([^}]*?)\s+TEST_INITIATION_TIME\s*([^}]*?)\s+TEST_COMPLETION_DATE\s*([^}]*?)\s+TEST_COMPLETION_TIME\s*([^}]*?)\s+ASSAY_CALIBRATION_DATE\s*([^}]*?)\s+ASSAY_CALIBRATION_TIME\s*([^}]*?)\s+TRACK\s*([^}]*?)\s+PROCESSING_LANE\s*([^}]*?)\s+MODULE_SN\s*([^}]*?)\s+LOAD_LIST_NAME\s*([^}]*?)\s+OPERATOR_ID\s*([^}]*?)\s+DARK_SUBREADS\s*([^}]*?)\s+SIGNAL_SUBREADS\s*([^}]*?)\s+DARK_COUNT\s*([^}]*?)\s+SIGNAL_COUNT\s*([^}]*?)\s+CORRECTED_COUNT\s*([^}]*?)\s+STD_BAK\s*([^}]*?)\s+AVG_BAK\s*([^}]*?)\s+STD_FOR\s*([^}]*?)\s+AVG_FOR\s*([^}]*?)\s+SHAPE\s*([^}]*?)\s+EXCEPTION_STRING\s*([^}]*?)\s+RESULT\s*([^}]*?)\s+REPORTED_RESULT\s*([^}]*?)\s+REPORTED_RESULT_UNITS\s*([^}]*?)\s+REAGENT_MASTER_LOT\s*([^}]*?)\s+REAGENT_SERIAL_NUMBER\s*([^}]*?)\s+RESULT_FLAGS\s*([^}]*?)\s+RESULT_INTERPRETATION\s*([^}]*?)\s+DILUTION_PROTOCOL\s*([^}]*?)\s+RESULT_COMMENT\s*([^}]*?)\s+DATA_MANAGEMENT_FIELD_1\s*([^}]*?)\s+DATA_MANAGEMENT_FIELD_2\s*([^}]*?)\s+DATA_MANAGEMENT_FIELD_3\s*([^}]*?)\s+DATA_MANAGEMENT_FIELD_4\s*([^}]*?)\s*}";  
  
  
  
      TEST_REPLICATE
      {
          REPLICATE_ID            353
          ASSAY_NUMBER            34224
          ASSAY_VERSION           99
          ASSAY_STATUS            VALKID
          DILUTION_ID         1
          SAMPLE_ID           "NC_3e2e2"
          SAMPLE_TYPE         Specimen
          TEST_ORDER_DATE         05.21.2012
          TEST_ORDER_TIME         03:44:01
          TEST_INITIATION_DATE        05.21.2012
          TEST_INITIATION_TIME        04:03:36
          TEST_COMPLETION_DATE        05.21.2012
          TEST_COMPLETION_TIME        04:29:32
          ASSAY_CALIBRATION_DATE      NA
          ASSAY_CALIBRATION_TIME      NA
          TRACK           1
          PROCESSING_LANE     1
          MODULE_SN       "EP334545004"
          LOAD_LIST_NAME          C:\BSQ_SASDACC\ASDADAjson
          OPERATOR_ID         "Q_SI"
          DARK_SUBREADS           NA
          SIGNAL_SUBREADS         NA
          DARK_COUNT          NA
          SIGNAL_COUNT            NA
          CORRECTED_COUNT         NA
          STD_BAK             NA
          AVG_BAK             NA
          STD_FOR             NA
          AVG_FOR             NA
          SHAPE               NA
          EXCEPTION_STRING        Test execution was stopped.
          RESULT              NA
          REPORTED_RESULT         NA
          REPORTED_RESULT_UNITS       NA
          REAGENT_MASTER_LOT      ASDADA
          REAGENT_SERIAL_NUMBER       25022
          RESULT_FLAGS            NA
          RESULT_INTERPRETATION       NA
          DILUTION_PROTOCOL       ASDASD
          RESULT_COMMENT          ASDA ASDA1
          DATA_MANAGEMENT_FIELD_1     NA
          DATA_MANAGEMENT_FIELD_2     NA
          DATA_MANAGEMENT_FIELD_3     NA
          DATA_MANAGEMENT_FIELD_4     NA
      }
  </code></pre>