Skip to content

Instantly share code, notes, and snippets.

@michalmikolajczyk
Last active August 29, 2015 14:18
Show Gist options
  • Save michalmikolajczyk/05ea97a0e2e0e86488b5 to your computer and use it in GitHub Desktop.
Save michalmikolajczyk/05ea97a0e2e0e86488b5 to your computer and use it in GitHub Desktop.
break js
// 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