The match on a string is simple:
var mystring = "This is my string";
var myregex = /*some regex*/
var results = mystring.match(myregex); // you can also write the regex directly as the argument of the match method, without using any variable.
So in your case you could have:
var mystring = "animal";
var myregex = new RegExp(inputQuery.replace(/\*/g, '.*'), 'gi'); // gi stands for 'global' and 'ignorecase' when applying the regex
var results = mystring.match(myregex);
Beware that .* matches zero or more (comes from the * whildcard) character, ANY character (comes from the .)
If you want to match zero or more letter, number or underscoreuse \w*, if you want to match one or more, use \w+, and if you want to match a specific number of letters, use \w{x} (\w{3} matches exactly 3 letters).
*by.*before applying regex\w*, else.*will match evenany animalwithan*al, and you say you need to match 1 word. The problem here is with Unicode letters. Do you need to also support Unicode?