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.
The metacharacter "." means "any character"

REGEXF=txt

all .txt files are selected

REGEXF=[rcb]at

bat.txt, cat.txt, rat.txt are selected
characters within the [ ] metacharacters form a set

REGEXF=[^bcr]at

hat.txt, mat.txt are selected      
^ within [ ] is the negation metacharacter.  Hence, bat.txt, cat.txt, rat.txt are rejected

REGEXF=[0-4].txt

1.txt, 2.txt, 6.txt, 7.txt, 8.txt are selected.
- is the range metacharacter.

REGEXF=[a-m[A-M]].txt

a.txt to m.txt, A.txt to M.txt are selected.
[a-m[A-M]]  is UNION of   [a-m] and [A-M]

REGEXF=[a-m&&[d-z]].txt

d.txt to m.txt are selected.
[a-m&&[d-z]]  is INTERSECTION of   [a-m] and [d-z]

REGEXF=[a-g&&[^cde]].txt

a.txt, b.txt, f.txt, g.txt are selected
[a-m[^cde]]  is SUBTRACTION of   [a-m] and [cde]

REGEXF=(?i)a.txt

a.txt, A.txt are selected
(?i) enables case-insensitive matching

REGEXF=a{3}.txt

aaa.txt, aaaaa.txt are selected
a{3} looks for 3 or more a's in a row 

REGEXF=[0-9]{1,}[^a-z]

123, 123123, 123123123 are selected
[0-9] looks for numbers, {1,} means 1 or more numbers
[^a-z] rejects all files with alphabets in them. ex: all  .txt

REGEXF=(123){2}

123123, 123123123 are selected
(xxx) implies a group.  (123) looks for the 123 group, {2} means 2 or more groups of 123

 

 

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]