Beware /g on regexps in JS
Successive matches may fail if the same string is used.
See http://jsbin.com/ixoqan/1/edit for an example.
Written by Ben Lowery
Related protips
1 Response
Interesting, the full explanation is in here:
http://stackoverflow.com/questions/2630418/javascript-regex-returning-true-then-false-then-true-etc
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Regexp
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#