Q:

regex find initials in sentence

I want to test if a string contains initials such as 'A.' or 'B. M.'.
Why is 
    bool(re.search("\b[A-Z]\.\b", 'A.'))

returning False?

A:

You haven't any word boundary after the dot, just remove it from the pattern:
re.search(r"\b[A-Z]\.", 'A.')

