can use filter() method in a string in javascript code example
Example: string filter javascript
var PATTERN = /bedroom/,
filtered = myArray.filter(function (str) { return PATTERN.test(str); });
var PATTERN = /bedroom/,
filtered = myArray.filter(function (str) { return PATTERN.test(str); });