If I have a string, e.g.: "Consensus IRIS 2010-11 Series 6"
If someone types part of that string, e.g. "iris" into a textbox, how can I identify the substring in the original string?
I have the following, but it only matches when the string starts with the value from the text box.
var txt= $('#txtName').val();
var regExp = new RegExp("^" + txt, "i");
var t = item.name.replace(regExp, "<span class='matched-text'>" + txt + "</span>");
Side note: I am baffled by regular expressions!