Skip to main content
Stack Overflow
  1. About
  2. For Teams

Timeline for Javascript if arrays contains string with regex

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
Apr 13, 2016 at 19:54 answer added Mike 'Pomax' Kamermans timeline score: 1
Apr 13, 2016 at 19:48 vote accept Community Bot
Apr 13, 2016 at 19:46 history edited user5672329 CC BY-SA 3.0
edited body
Apr 13, 2016 at 19:46 comment added user5672329 @Mojtaba oh that's just and error when copying & past, but thanks
Apr 13, 2016 at 19:45 answer added Seth timeline score: 8
Apr 13, 2016 at 19:44 comment added Mojtaba @MrZ, Check your curly braces. It seems you have some error in defining CMS as well.
Apr 13, 2016 at 19:40 comment added user5672329 @Mike'Pomax'Kamermans Can you make an answer please?
Apr 13, 2016 at 19:37 comment added Mike 'Pomax' Kamermans If you want to do regexp testing, why start with strings? Just store regexp: var arr = [/test/, /foo/, /bar/, /news-\d+/]; and then do an arr.forEach(re => re.test(...)) or for (re of arr) { re.test(...) } (with the benefit that the latter will let you break out of the loop, while the former won't)
Apr 13, 2016 at 19:35 history edited user5672329 CC BY-SA 3.0
added 767 characters in body; edited tags
Apr 13, 2016 at 19:32 comment added user5672329 execute callback(). Just posting my code wait
Apr 13, 2016 at 19:31 comment added Andy Add your code to the question so we can see what happened. Also, what do you want to happen if it finds a match?
Apr 13, 2016 at 19:30 history asked user5672329 CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /