title: Why doesn't $ in .NET multiline regular expressions match CRLF?
body: <p>I have noticed the following:</p>
  
  <pre><code>var b1 = Regex.IsMatch("Line1\nLine2", "Line1$", RegexOptions.Multiline);   // true
  var b2 = Regex.IsMatch("Line1\r\nLine2", "Line1$", RegexOptions.Multiline); // false
  </code></pre>
  
  <p>I'm confused. The documentation of <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions.aspx">RegexOptions</a> says:</p>
  
  <blockquote>
    <p><strong>Multiline</strong>: 
    Multiline mode. Changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string.</p>
  </blockquote>
  
  <p>Since C# and VB.NET are mainly used in the Windows world, I would guess that most files processed by .NET applications use CRLF linebreaks (<code>\r\n</code>) rather than LF linebreaks (<code>\n</code>). Still, it seems that the .NET regular expression parser does not recognize a CRLF linebreak as an <em>end of line</em>.</p>
  
  <p>I know that I could workaround this, for example, by matching <code>Line1\r?$</code>, but it still strikes me as strange. Is this really the intended behaviour of the .NET regexp parser or did I miss some hidden <code>UseWindowsLinebreaks</code> option?</p>