I am using this regex to match email addresses in a string.
Everything works fine here: http://regexr.com?31e5a with this regex:
([\\w-\\.]+)@((?:[\
Your immediate problem (by your own comments) is that you are using capturing groups in you regex, where you should be using non-capturing ones, or better, none at all:
emailsString = 'aaaaaaa@bbbb.com xxxxxxx cccccc@ffffdd.com';
emails = emailsString.match(/[\w-\.]+@[\w]+\.+[a-zA-Z]{2,4}/g);
// emails = ["aaaaaaa@bbbb.com", "cccccc@ffffdd.com"]