How does \B regular expression work in Python?

PythonServer Side ProgrammingProgramming

The word boundary \b matches positions where one side is a word character (usually a letter, digit or underscore)

\B matches all positions where \b doesn't match.

The following code shows how regexpr \B works

import re
result = re.findall(r'\Bcat', 'certificate')
result2 = re.findall(r'\Bcat', 'tomcat')
result3 = re.findall(r'\Bcat', 'catfish')
print result, result2,result3

This gives the output

['cat'] ['cat'] []
Published on 03-Jan-2018 17:13:59