Trying to find folders that start with variables that are NOT case sensitive
var varname = ("BUI")
var stringMatch = "\\" + varname + "\\b";
if (FolderItems[i].name.match(stringMatch)) {
//do script
}
I find Regex pretty confusing, I know varname = \\\BUI\\\b, but what do I need to find a folder that begins with that variable? I’d like this to find a folder called 'Building_v02'
In the JavaScript regexp syntax,
^is the anchor for the start of the string. Case insensitivity is indicated separately with theiflag:However, you should escape the string if it could contain any undesirable regexp metacharacter.
Also note that you may not have to use a regexp:
To actually iterate over the array of items: