- \b
Anchor edge of word
- \b beginning of word or end of word
examples/regex/anchor_b.py
import re text = 'x a xyb x-c qwer_ ut!@y' print(re.findall(r'.\b.', text)) print(re.findall(r'\b.', 'a b ')) print(re.findall(r'.\b', 'a b '))
['x ', 'a ', 'b ', 'x-', 'c ', '_ ', ' u', 't!', '@y'] ['a', ' ', 'b', ' '] ['a', ' ', 'b']