ES6 filter an array with Regex

后端 未结 5 2020
清歌不尽
清歌不尽 2020-12-08 21:47

I\'m trying to filter an array that contains a bunch of urls. I need to return the urls that only contain the word \"contact\".

For example there is a link htt

5条回答
  •  一向
    一向 (楼主)
    2020-12-08 22:30

    I realize that the question requests regex, but the sensible answer here is

    someArray.filter(str => str.includes('contact'))
    

提交回复
热议问题