I have noticed that the word boundary \bword\b
does not work inside brackets when doing a preg_replace()
in PHP.
Specifically, I'm trying to exclude the full word >
(which stands for >
in HTML), but since the word boundary does not trigger inside brackets as in [^\b>\b]
, any of those characters by itself, like g
or &
, will be detected as a non-match. If you try to do a match outside the brackets, \b
works as expected in PHP even though the word starts with a &
a non-character.
Any thoughts/ideas to get around this situation?