sub compareFolder { my $folder = shift; $folder = uc ($folder); while ($folder =~ /\\/) { $folder =~ s/\\/\//; # transform regular c:\sample\path into c:/ +sample/path for later comparison } my $mode = shift; my @wantedF = @{+shift}; my @bannedF = @{+shift}; for (0..$#wantedF) { return ACCEPTED if ($folder eq uc($wantedF[$_])); # if folder is + directly equal to a desired(forced) folder } for (0..$#bannedF) { return BANNED if ($folder eq uc($bannedF[$_])); # if folder is + directly equal to a banned folder if ($mode == INC_SUBDIRS) # if a parent folder is banned then so + are the subfolders unless otherwise stated { my $bFolder = uc($bannedF[$_]); return BANNED if ($folder =~ /(^$bFolder\/).*/); # example : +$folder = c:\temp\one; $bannedF[$_] = c:\temp } } return ACCEPTED; # if execution reaches this point, then folder isn +'t affected by the forced/banned folder list # hence it can be scanned. }
In reply to [Re: Reg Ex : an odd error...] New Code
by Foggy Bottoms
in thread Reg Ex : an odd error...
by Foggy Bottoms
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |