Filename Selection
We provide two separate custom wildcard systems. Combining these two systems provides more flexibility than either the DOS or Unix wildcard systems.
System 1 - Custom wildcard -
System 2 - Regular Expressions (Regex) There are lots of Regex tutorials online. To use Regex, your filename should start with 'REGEXF=' or 'REGEXM='.
You can use either System 1 OR System 2 for the filename. Please note that System1 and System 2 have very little in common. The * , ! and ^ used in System 1 have completely different meanings in System 2 (Regex).
System 1 - Custom wildcard
1) Multiple sets of filenames can be selected using ^.
2) Each filename can contain 1 or more string tokens, separated by *.
3) Each * also stands for one character (or more).
4) Filenames containing all individual tokens entered, in the correct sequence, are selected.
5) The index of an individual token in the filename selected cannot be less than the index of that token in the filename entered.
6) The length of the filename selected should always equal or exceed the length of the filename entered.
7) If * (or multiple *) is at the end, it is ignored. However, the length of the filename selected, will equal or exceed the length of the filename entered.
8) For exact filename search, use # at start of filename. This ensures only one file with the exact name, will be selected.
9) To exclude filename (or filenames), use ! at the start of filename. The exclusion filename should be followed by at least one other token separated by ^. The exclusion filename (filenames) should also be listed before any normal filename. Examples: !.zip^* or !.zip^.txt or
!.txt,!.zip,.htm,.gif
10) To specify a case insensitive token, use (?i) at the start of the filename.
Example: (?i)test.txt
Consider a directory with the following files:
junk, test, temp, TEMP, temp1, temp.txt, temp.htm, Test, Temp.txt, teeempju.txt, activityLog.txt, debugLog.txt, test.zip, test.gif
Filename entered |
Files Selected |
|
All files selected |
* |
All files selected |
te |
test, temp, temp1, temp.txt, temp.htm,teeempju.txt |
ju |
junk,teeempju.txt |
T |
Test, Temp.txt |
.txt |
temp.txt, Temp.txt, teeempju.txt, activityLog.txt, debugLog.txt |
te*htm |
temp.htm |
te*emp |
teeemp.txt |
te*htm^debug |
temp.htm, debugLog.txt |
te*htm^te*emp^debug |
temp.htm, teeemp.txt, debugLog.txt |
temp*.txt |
No files selected (rule 5) |
*********** |
teeempju.txt, activityLog.txt, debugLog.txt (rule 6) |
est** |
No files selected (rule 6) |
est* |
test, Test (rule 6 and 7) |
#temp |
temp (rule 8) |
!.zip^* |
All files except test.zip (rule 9) |
!.txt^temp |
temp,temp1,temp.htm (rule 9) |
(?i)temp | temp,temp1,temp.htm, TEMP, Temp.txt (rule 10) |
System 2 - Regular Expressions (Regex)
Regex is a very large subject. It contains lots of syntax that cannot all be listed here. Please search the Internet for tutorials on Regex.
REGEXF method scans the filename to find the next subsequence that matches the pattern entered in filename field.
REGEXM method attempts to match the entire filename against the pattern entered in the filename field.
We recommend that you use the REGEXF method first.
Java Regex has the following defined metacharacters([{\^$|)?*+. These are special characters that can affect the way a pattern is matched. See the examples below for the use of these metacharacters.
Consider directories with the following sets of files:
bat.txt, cat.txt, rat.txt, hat.txt, mat.txt
1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt
a.txt, b.txt ... to z.txt & A.txt, B.txt .... to Z.txt
aa.txt, aaa.txt, aaaa.txt
123, 123123, 123123123
Filename entered |
Files Selected |
REGEXF=. |
All files selected. |
REGEXF=txt |
all .txt files are selected |
REGEXF=[rcb]at |
bat.txt, cat.txt, rat.txt are selected |
REGEXF=[^bcr]at |
hat.txt, mat.txt are selected |
REGEXF=[0-4].txt |
1.txt, 2.txt, 6.txt, 7.txt, 8.txt are selected. |
REGEXF=[a-m[A-M]].txt |
a.txt to m.txt, A.txt to M.txt are selected. |
REGEXF=[a-m&&[d-z]].txt |
d.txt to m.txt are selected. |
REGEXF=[a-g&&[^cde]].txt |
a.txt, b.txt, f.txt, g.txt are selected |
REGEXF=(?i)a.txt |
a.txt, A.txt are selected |
REGEXF=a{3}.txt |
aaa.txt, aaaaa.txt are selected |
REGEXF=[0-9]{1,}[^a-z] |
123, 123123, 123123123 are selected |
REGEXF=(123){2} |
123123, 123123123 are selected |
|
|
Predefined character shortcuts:
\d
matches all digits = [0-9]
\D
matches non-digits = [^0-9]
\s
matches spaces = [ \t\n\x0B\f\r]
\S
matches non-spaces = [^\s]
\w
matches word characters = [a-zA-Z_0-9]
\W
matches non-word characters = [^\w]