Why \b regex is not matching correctly?

As per re docs, \b matches an empty string both at start and end of a word, with the word being a combination of characters of the \w class.

So basically \b represents a sort of boundary between separated words. And in fact the following matches as expected:

re.match(b"\bfoo\b", "foo bar")

But surprisingly this doesn't:

re.match(r"\bfoo\b", "bar foo baz")

Why is the left boundary behaving differently? I'm sure I'm missing something here, or maybe I'm not fully understanding how \b works.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum