My goal in the below was to create a regex that would match the string "a.b.c.", (where the . are actual periods), but not match strings like (say) "ga.b.c.h" (i.e., non-space, alphanumeric characters before and after the "a.b.c." part).
My thinking was to use the \b operator, and of course I had to also escape the periods in the expression in my regex. The Python 2 documentation states (https://docs.python.org/2/library/re.html) that \b is formally the boundary between \w and \W.
I do not understand why this expression fails to match:
>>> reg = re.compile(r'\ba\.b\.c\.\b')
>>> bool(re.match(reg, "a.b.c."))
False
Can anyone here enlighten me?