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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -