var myPattern = /^(.*)/ig; var matchStation = mass.filter(function (station) { if (station.search(myPattern) > 0) return station; }); matchStation.forEach(el => console.log(el)); mass - an array of 160 stations. search() does not work (the matchStation array matchStation always empty). What am I doing wrong?