What is one use for wildcards? Let's say that you write a script that takes some text file and reformats it with HTML tags so that it becomes an HTML file (ie, website page). When the user runs your script, he supplies an argument that is the name of the text file to reformat. Here's a brief skeleton of how your script may appear:
/* Get the argument the user supplied. It is the * name of the text file to reformat. */ filename = ARG(1) /* Call a function to read the text file, reformat it, * and save it as an HTML file. */ result = reformat(filename) RETURNLet's say that the user has several text files he wishes to reformat. The name of each text file ends with .TXT, and they are all in the directory C:\MYDIR. He could run your script for each text file, specifying that file's name. Or, if you wrote your script to accept any number of arguments, then he could run your script once, and type the full names of all files, each separated by a comma. But if your script supported wildcards, he could run your script once, and supply a name of only C:\MYDIR\*.TXT.
The * is a wildcard character and it is meant to be replaced with any number of characters up to a dot. So what the user wants you to do is look in the C:\MYDIR directory, and check all filenames that have any amount of characters, and then end with *.TXT. So he wants you to operate upon all files in that directory with a .TXT extension. By using wildcards in the filename, he can quickly tell you to operate upon a group of files that all have something in common in their names.
Of course, the above script needs to read the contents of each file. LINEIN() and CHARIN() do not support wildcards. If you were to pass a filename of C:\MYDIR\*.TXT then those functions would try to read a filename that really was *.TXT (which is an illegal name under Windows). So, you need to be able to query the contents of a directory and filter only those filenames that match the desired wildcard template. Then you can reformat each matching file by passing its name to LINEIN or CHARIN to read its contents, reformat the contents, and save the contents.
Reginald has some proprietary built-in Functions to perform various tasks, with wildcard support. In addition to a function to query the contents of a directory using wildcards, Reginald also has functions to copy, move, and delete files using wildcards. So for example, if you wish to delete all files in a certain directory whose names end with a .DAT extension, you can do this with a single function call. The following sections will detail various Reginald functions that operate upon files and directories, and can give you an idea of how much work you can save yourself by utilizing wildcards when you're dealing with groups of files, or a directory's entire contents.