Last active
August 29, 2015 14:18
-
-
Save michalmikolajczyk/05ea97a0e2e0e86488b5 to your computer and use it in GitHub Desktop.
break js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code goes here | |
var regexString = '([^-]*)'; | |
var flags = 'ig'; | |
var regex = new RegExp(regexString, flags); | |
var arr = ['some-property-image.png', 'another-prop-video.png', 'y-no-work.bmp']; | |
var result = []; | |
arr.forEach(function (item) { | |
var match; | |
var inter = []; | |
while(match = regex.exec(item)) { | |
inter.push(match[0]); | |
} | |
}); | |
console.log(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment