Contents - Index - Previous - Next


Working with wildcards


 

 

Valid wildcard characters: 

* Matches any number of contiguous characters 

? Matches any single character 

<> Encloses multiple possibilities for a single character 

^ Matches anything but what follows inside <> 

! Same as ^ 

- Range of characters within <> 

*<> Matches any number of contiguous characters as long is it satisfies the possibilites inside the following brackets.  

Examples:  

<a-h> matches any single character from a through h 

<!a-h> matches any single character that isn't a through h 

<anplx> matches any single character as long as it is an a, n, p, l, or x. 

*<a-e> Matches any contiguous characters as long as they are all a thru e 

*<!a-e> Matches any contiguous characters as long as they are all NOT a thru e 

  

'ma?ch.* Would match match.exe, mavch.dat, march.on, etc 

this <e-n>s a <!zy>est Would match 'this is a test', but would not match 'this as a yest' 

c:\windows\sys???\*.ini Would match c:\windows\system\system.ini, c:\windows\sys001\abc.ini, but not c:\windows\system1\system.ini or c:\windows\sys\defg.ini 

  

Complex wildcards may be used when specifying which files are to be zipped.  This includes wildcard characters not only in the filename but also in the pathname.  This allows you to specify directories using wildcards, for instance:  

 

VCLZip1.FilesList.add('c:\test\w*\mycode*.pas');  

 

would get all PAS files beginning with mycode in subdirectories under TEST that begin with the letter w.  Wilcards may be much more complex than this.