I would expect that this
var r = new RegExp(\'\\\\s\\\\@[0-9a-z]+\\\\s\', \'gi\');
applied to this string
1 @bar @foo2 * 112 >
"\w" Matches any word character (alphanumeric & underscore). Only matches low-ascii characters (no accented or non-roman characters). Equivalent to [A-Za-z0-9_] Best source to learn : www.regexr.com