Code: Select all
var arr = ['a.jpg', 'b.jpg'], reg = /\.jpg$/i
for(var i = 0; i < arr.length; i++) {
alert(arr[i].search(reg) != -1)
}
When I applied modification to that code it worked correctly so like in mentioned sites.
Code: Select all
var arr = ['a.jpg', 'b.jpg']
for(var i = 0; i < arr.length; i++) {
alert(arr[i].search(/\.jpg$/i) != -1)
}
Code: Select all
var arr = ['a.jpg', 'b.jpg'], reg = /\.jpg$/i
for(var i = 0; i < arr.length; i++) {
alert(arr[i].search(reg) != -1)
reg = /\.jpg$/i
}
I found it analysing Mike Hale code (still I have no idea how that worked for him, if he tested it of course, because that was only answer to someone problem). When you'll check it just replace mask variable in 14th line:
Code: Select all
if (procFiles[i].fullName.search([b]mask[/b]) != -1) allFiles.push(procFiles[i]); // otherwise only those that match mask
Here's that topic (look for his answer from 2013-07-02 13:49): https://forums.adobe.com/thread/1246514
Post Scriptum. I found that from JavierAroche answer-link to this topic https://www.ps-scripts.com/viewtopic.php?f=66&t=24364, after I replied my answer-code which after few posts (of others meantime) is still not accepted by moderator or just vanished(?)