Doesn't `\B` match a non-word boundary? Feels like it should probably be `\b` instead?

Also, `\A` doesn't look like a regexp escape code in JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions