title: Why doesn't "$" work while "(\r|\n)" DOES work in a simple re.search() command with the re.MULTILINE flag set?
body: <p>I have stumbled upon a very strange situation, where &quot;$&quot; doesn't work (does not match line-ends) while &quot;(\r|\n)&quot; DOES work, in a simple re.search() command with the re.MULTILINE flag set, and I really wonder why this is?</p>
  <p>Here is a short PoC, including its runtime output (when executed on Python 3.7.1):</p>
  <pre><code>import re
  
  subj = 'row1\r\nContent-Length: 1234\r\nrow3'
  test1 = re.search(r'^Content-Length: ([0-9]+)$', subj, re.MULTILINE)
  test2 = re.search(r'^Content-Length: ([0-9]+)(\r|\n)', subj, re.MULTILINE)
  if test1:
      print('test1 is a match!')
  else:
      print('test1 is NOT a match!')
  if test2:
      print('test2 is a match!')
  else:
      print('test2 is NOT a match!')
  </code></pre>
  <p>and here is the output when running this code:</p>
  <pre><code>test1 is NOT a match!
  test2 is a match!
  </code></pre>
  <p>As far as I can read in all the docs, the &quot;$&quot; should represent any line-break when using regexps in multiline mode, so why does it refuse to match in this case?</p>