If you want to dynamically create a RegExp object from a string you need to use the constructor:
console.log(str.match(new RegExp(searchTerms.join('|'), 'g')));
However, I'd generally recommend some other approach. If your search terms contain a special regex character (e.g. $), then this is likely to fail. Of course you could escape those special characters, but still, I'd recommend you look for some other solution if possible.
It's hard to say exactly what solution would look like, since I don't know the full use case, but here's a very simple example of an alternative solution:
var str = 'I have a dog and a cat';
var searchTerms = {'dog': 1, 'cat': 1};
console.log(str.split(/\s+/).filter(function(x) { return x in searchTerms; }));
// [ "dog", "cat" ]