Lorem ipsum 'vendor/js/srcipt.js' dolor sit amet, 'lib/ls/jquery/jquery.min.js' consectetur 'img/pict.jpg' adipisicing 'vendor/style/some-style.min.css' elit. Adipisci, tenetur?
vendor
и заканчиваются на js
или css
, но без слово vendor['js/srcipt.js', 'style/some-style.min.css']
var testStr = "Lorem ipsum 'vendor/js/srcipt.js' dolor sit amet, 'lib/ls/jquery/jquery.min.js' consectetur 'img/pict.jpg' adipisicing 'vendor/style/some-style.min.css' 'vendor/style/some-style.less' или 'vendor/img/bla.png' elit. Adipisci, tenetur?";
var reqExpWrapper = new RegExp('(?:vendor/)((?:.*?)\\.(?:css|js))\'', 'g');
var matches = new Array();
while(match = reqExpWrapper.exec(testStr))
{
matches.push(match[1]);
}
console.log(matches);
var str = "Lorem 'vendor/img/pict.jpg' ipsum 'vendor/js/srcipt.js' dolor sit amet, 'lib/ls/jquery/jquery.min.js' consectetur 'img/pict.jpg' adipisicing 'vendor/style/some-style.min.css' elit. Adipisci, tenetur?";
var re = /'vendor\/(\S?\.(?:css|js))'/g;
var m, matches = [];
while(m = re.exec(str)) {
matches.push(m[1]);
}
console.log(matches);
https://jsfiddle.net/jmsa75zj/