Yeah, you pretty much had it. You just needed to pass your regex string into the RegExp constructor. You can then call its test()
function.
var matcher = new RegExp("%" + number + ":", "g");
var found = matcher.test(textinput);
Hope that helps 🙂