I've been using an alternative to RegEx by looking for the domain in the referrer
if (document.referrer.indexOf('reddit.com') >= 0) { alert('They came from Reddit.com'); }
EDIT: As thekingoftruth points out that doesn't work if reddit.com is included in an URL parameter so I've extended it a little. I've also added toLowerCase() as I spotted that in the RegExp above.
if (document.referrer.indexOf('?') > 0){
if (document.referrer.substring(0,document.referrer.indexOf('?')).toLowerCase().indexOf('reddit.com') >= 0){
alert('They came from Reddit');
}
} else {
if (document.referrer.toLowerCase().indexOf('reddit.com') > 0){
alert('They came from Reddit');
}
}