I would expect that this
var r = new RegExp(\'\\\\s\\\\@[0-9a-z]+\\\\s\', \'gi\');
applied to this string
1 @bar @foo2 * 112 >
Yes, \w does match latin numbers. \w == [A-Za-z0-9_]
\w
\w == [A-Za-z0-9_]
Assuming you want to remove @fooX, you can use:
@fooX
console.log("1 @bar @foo2 * 112".replace(/\s@\w+/g, ""));