title: Node.js: Regular Expression To Delete Entire Line
body: <p>How do I match the entire line starting with MTA: ?</p>
  
  <p>If I use: </p>
  
  <pre><code>console.log(result[2].split("Reporting-MTA:"))
  </code></pre>
  
  <p>I will still get the rest of the line, I want to match the entire line starting with MTA:</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <p>I want to match the line so I can read the lines BEFORE and AFTER that entire line. Now, I can only read the lines before and after the string "Reporting-MTA:"</p>
  
  <p>Edit2:</p>
  
  <pre><code>2u+in.4eBZWuGLW.HROP9.bB7WHG
  content-type: message/delivery-status
  
  Reporting-MTA: dns; na-mm-outgoing-6102-bacon.iad6.com
  
  Final-Recipient: rfc822;g
  Action: failed
  Status: 5.0.0 (permanent failure)
  Diagnostic-Code: smtp; 5.1.2 - Bad destination host 'DNS Hard Error looking up tiagop.fdforg (MX):  NXDomain' (delivery attempts: 0)
  
  
  
  /node/server.js:92
                  console.log(r[1]);
                 ^
  TypeError: Cannot read property '1' of null
  </code></pre>
  
  <p>With this code:</p>
  
  <pre><code>console.log(result[2]);
          var r = result[2].match(/(.*)\r\nReporting-MTA\r\n(.*)/)
          console.log(r[1]);
  </code></pre>