Why there is a match here:
scala> """\bdog\b""".r
res65: scala.util.matching.Regex = \bdog\b
scala> res65.findFirstIn(" The dog plays in the yard")
res66: Option[String] = Some(dog)
But not here:
scala> "The dog plays in the yard".matches("""\bdog\b""")
res67: Boolean = false
?
Regex.IsMatch()also finds substrings. In Pythonre.match()only anchors the search at the start but not the end of the string. Regular expressions are confusing on their own, but the different implementations vary wildly enough to make a grown man cry (unless he's got RegexBuddy, of course).