I have a query that needs answering:
How can I utilize RegExp in JavaScript to locate strings that adhere to this filter:
*[0-9].png
for the purpose of filtering out sequences of files.
For instance:
dog001.png
dog002.png
dog003.png
or
xyz_1.png
xyz_2.png
The goal is to disregard strings like xyz_1b.png
and xyz_xyz.png
.
This will be used within a getFiles function.
var regExp = new RegExp(???);
var files = dir.getFiles(regExp);
Many thanks in advance!
EDIT:
If I have a specific string, let's say
var beginningStr = "dog";
How do I verify if a string fits the filter
beginningStr[0-9].png
? And ideally allowing for the use of beginningString without regard to case sensitivity. This way, the filter would accept Dog01 and DOG02 as well.
Thanks once again!