My code:
var string = "I put putty on the computer. putty, PUT do I"
var uniques = {};
var result = (string.match(/\b\w*put\w*\b/ig) || []).filter(function(item) {
item = item.toLowerCase();
return uniques[item] ? false : (uniques[item] = true);
});
document.write( result.join(", ") );
Here i want pass a variable inside the expression
here i have pass a value 'put' and get answer. But i have to use variable for this value.
I have tried string.match(/\b\w*{+put+}\w*\b/ig
Can you share your answers