Expression Wizard (Expr Wiz)
|Top Previous Next|
When the 'Regular Expression' expression type is selected in the Options tab is checked
and the user clicks on the 'Help' button the Expression Wizard dialog is opened to help the user create a regular expression.
The Expression Wizard walks the user through creating a basic regular expression. It can be used for building expressions to search for either the file name or the file contents.
Note: The term 'string' is used as a generic term referring to either the file name or file contents. Basically a string is any word or group of words which, if you think about it, is exactly what a file name is.
First page (Introducing the Expression Wizard)
The first page of the wizard is just an introduction for the Expression Wizard with notes for the particular type of expression being built (i.e. a note for file name and a different note for file contents).
Second page (Create the Expression)
The second page is where all the work takes place. It should look something like this:
Shown above is an example expression for a file name and will find any file name that includes the phrase 'MyFile' followed by any character followed by any number and finally ending with '.txt', i.e. a text file. Therefore it would find files such as 'Dave_MyFile54.txt' or 'MyFile_Num2.txt' but would not find the files 'MyFile.txt', 'A_MyFile34a.txt', or 'MyFile34.doc'.
If you think back to how regular expressions work the layout of the Expression Wizard should become apparent. A regular expression is built out of a number of 'entries'. There is one beginning entry, multiple main body entries, and one final end entry. Each entry has a specific type:
• Don't know. The value of the entry is unknown. e.g. The beginning of the file name may be unknown.
• Any character. Matches to any single character.
• The character. Matches to a character entered by the user in the Text field.
• Any one of these characters. Matches to any one of the characters entered by the user in the Text field.
• Any character except these. Matches to any character except the ones entered by the user in the Text field.
• The phrase. Matches to the specific phrase entered by the user in the Text field.
• Space(s). Matches to a space.
• Any numeric character. Matches to any numeric character, i.e. 0-9.
• Any text character. Matches to any alphabetic character, i.e. a-z.
Once the user has specified the entry type and the text, if required for the entry type, then the user needs to specify the number of occurrences of that entry:
• Zero or once. The entry type may or may not be there but if it is then it maps to one occurrence.
• Zero or many times. The entry type may or may not be there but if it is then it can map to one or more occurrences.
• Once only. The entry type must be there and is mapped to only one occurrence.
• Once or many times. The entry type must be there and can map to many occurrences.
The Expression Wizard does not currently provide all the functionality of regular expressions. However, if the user knows how to construct their own regular expressions they can enter the any part of a regular expression by adding an entry of type 'The phrase' and putting the regular expression in the Text field.
The entries can be rearranged using drag and drop.
Third page (Warning: Special characters entered)
When the user has finished entering the regular expression the user can normally press Finish to feed the regular expression back to the main search window. However, if the user has entered any special characters (i.e. characters that have special meaning in a regular expressions) in the Text field for any entry then the Finish button actually changes into a Next button and the user is warned that special characters were entered. The user then has two choices, either to have Agent Ransack convert the special characters so that they will not be treated as special (default) or to leave the expression as it is because the user specifically entered special characters.
In the screen shot shown above you can see that this is exactly what happened with the example. The '.' in '.txt' is the wildcard character and therefore instead of a Finish button there is a Next button. If you look at the resulting expression you'll see that the '.' has been prefixed with the '\' escape character. This happened automatically because of the default action, which is to convert the special characters so that they are not treated as special. This page (i.e. the third page) allows the user to turn that default action off.