dimanche 19 octobre 2014

javascript regex match on array to find multiple items


Vote count:

0




Is possible to do a regex match on an array to find all the items containing certain letters?


My array is:



var myArray = [
"move",
"mind",
"mouse",
"mountain",
"melon"
];


I need to find all items containing the letters: "mo", using a regex match like this:



/mo\w+/igm


To output these words: 'move', 'mouse', 'mountain'...


How can I do it in javascript?



asked 55 secs ago







javascript regex match on array to find multiple items

Aucun commentaire:

Enregistrer un commentaire