<regex>
: Fix word bounds \b
and \B
when applied to the empty string by muellerj2 · Pull Request #5375 · microsoft/STL (original) (raw)
Fixes #5371.
The ECMAScript standard effectively states that \b
matches a position i
in the string iff IsWordChar(i-1) xor IsWordChar(i)
is true. It also defines that for positions i = -1
and i = length(input)
, IsWordChar(i)
always returns false
. Thus, \b
does not match anything in the empty string.
Since \b
does not match the empty string, the flags match_not_bow
and match_not_eow
don't matter in this case.