Q:

Alphabetical word boundary in PHPs regular expressions

\b specifies a word boundary in regular expressions; however, it treats a digit as a word character. Is there a way of denoting a boundary where digits are not considered part of the word (i.e., just alphabetical characters)?
Must work at the start and end of string like \b does.
I'm using PHP's PCRE version of regular expressions.

A:

You will have to use custom assertions for this:
 (?<![a-z])word

Replaces the leading \b.
 wordend(?![a-z])

Probes that no letter follows your word.
Of course you could also test for more specific character lists, or even just \spaces.

