RegExp.escape = function(text) {
if (!arguments.callee.sRE) {
var specials = [
'/', '.', '*', '+', '?', '|',
'(', ')', '[', ']', '{', '}', '\\'
];
arguments.callee.sRE = new RegExp(
'(\\' + specials.join('|\\') + ')', 'g'
);
}
return text.replace(arguments.callee.sRE, '\\$1');
}

document.getElementById("txt-search").addEventListener('keyup', function(event) {

var search = "%" + RegExp.escape(event.target.value.toLowerCase());

document.getElementsByClassName("li.record").forEach(function(){

var firstname = event.target.getAtrribute('data-firstname').toLowerCase();
var lastname = event.target.getAtrribute('data-lastname').toLowerCase();
var email_contact = event.target.getAtrribute('data-email_contact').toLowerCase();

var matchFirstName = new RegExp(search.replace("%", ".*").replace("_", ".")).exec(firstname) != null;
var matchLastName = new RegExp(search.replace("%", ".*").replace("_", ".")).exec(lastname) != null;
var matchEmail = new RegExp(search.replace("%", ".*").replace("_", ".")).exec(email_contact) != null;

if (matchFirstName || matchLastName || matchEmail) {
this.style.display ='block';
}
else {
this.style.display ='none';
}
});
});