$ ./guess_the_languageRegex
Regex · hard · #21

In Python re, what does this tuple evaluate to?

import re
(bool(re.search(r'^abc$', 'abc\n')),
 bool(re.search(r'^abc\Z', 'abc\n')))
  1. (True, False)
  2. (False, False)
  3. (True, True)
  4. (False, True)
In Python $ also matches just before a trailing newline, while \Z matches only at the very end.
Play Regex ▸