I would like to explain Alan Moore's answer
A word boundary is a position that is either preceded by a word character and not followed by one or followed by a word character and not preceded by one.
Suppose I have a string "This is a cat, and she's awesome", and I am supposed to replace all occurrence(s) the letter 'a' only if this letter exists at the "Boundary of a word", i.e. the letter a
inside 'cat' should not be replaced.
So I'll perform regex (in Python) as
re.sub("\ba","e", myString.strip())
//replace a
with e
so the output will be
This is e
cat e
nd she's e
wesome