Regex global match for Nodejs not working

I've tried this a million times and have searched EVERYWHERE! I cannot get this to work. I'm trying to extract the text of a tweet and look for a global match it only works when it matches it absolutely, but not if I add a word next to it. FYI I'm trying to do this in NodeJS.

ex:

var userTweet = tweet.text;
var gold = userTweet.match(/#gold/g);
console.log(gold);

console.log(userTweet);

if (userTweet == gold) {

        console.log('got it'); // only grabs it if it exactly matches the tweeted string
    }
    else {
        console.log('not getting it'); // if any other word besides 'gold' is present         doesn't work at all
    }
});

I'd like to add that I'm writing my code within the Twit stream.

and placed inside this function:

stream.on('tweet', function(tweet) { 


}

I'm basically expecting to track a key word and a specific user. But when I try to track a specific word, it overrides the user I want to track and tracks every user that uses that key word.

--- for anyone facing the same problem I ended up just using the twitter-text module. Although it has it's issues as well.

You could use a regexp like /#gold.*?\b/g instead:

> '#gold'.match(/#gold.*?\b/g)
[ '#gold' ]
> '#gold #asdf #golden'.match(/#gold.*?\b/g)
[ '#gold', '#golden' ]
> 'yay #gold #golddigger woohoo!'.match(/#gold.*?\b/g)
[ '#gold', '#golddigger' ]

You may also want to add /i to the modifiers so you can find #GOLD, #GoLd, etc.