I figured out the bug. Inside a set of square brackets, \s doesn't match whitespace. It matches s instead. I'm uncertain exactly how the ECMA-262 part 15.10 regular expression specification is meant to handle that situation.