Currently, I'm facing challenges with a small script that is designed to compare the value from a text input with items in an array either partially or completely.
I am struggling specifically with the regular expression and its syntax. I was hoping to get some guidance on this matter.
for (var i=0; i < liveFilterData.length; i+=1) {
if (liveFilterData[i].match(liveFilter.val())) {
alert();
}
}
The goal is for liveFilter.val() and the Regular Expression to align with the current array item liveFilterData[i]. This means that if someone enters 'H' or 'h' in the text box, it will check if there is a matching item in the array. If they type 'He' or 'he', it should match 'Head', 'Header', or 'Heading'.
Apologies, despite searching extensively online for resources on constructing regular expressions, I haven't been able to figure it out.