I am trying to catch all words that contains "centimeters", like: 10.50centimeters from this sentence "This product have 10.50centimeters length..".
my function:
function findMatchingWords(t, s) {
var re = new RegExp("\\w*"+s+"\\w*", "g");
return t.match(re);
}
findMatchingWords('This product have 10.50centimeters length..','centimeters');
but returns only "50centimeters". Is not getting the numbers before the dot.
Any help with this please?