Converting shell wildcards to regex

后端 未结 3 788
死守一世寂寞
死守一世寂寞 2020-12-16 21:01

I want to search for titles using shell wildcards like *.js, *.*.* etc. in js. The thing is I loop through a list of titles and I need to filter th

3条回答
  •  甜味超标
    2020-12-16 21:11

    if regexp used to get boolean result (when you don't need a match result), it is better to use test method.

    /.*\.js$/i.test(yourVar)

提交回复
热议问题