regex - javascript RegExp space character breaks test method -
i trying search using javascript, , using regexp
if searching on 1 word fine, if search 2 words e.g "a string" no results - though using string exists in data searching, here code,
groupcollection.prototype.search = function(letters) { if(letters == "") return this; var pattern = new regexp(letters, "gi"); return _(this.filter(function(data) { return pattern.test(data.get("name")); })); }
is there reason regexp not accept space?
Comments
Post a Comment