Characters
|
Meaning
|
|
---|---|---|
? | Match any single character, including "." but not "\" or "/". | |
* | Match any number of characters, including "." but not "\" or "/". | |
[a-z] | An example range: match any character a through z. | |
[^a-z] | An example exclusion range: match any character not in the set a through z. | |
{a,b}c | Alternation: generate both ac and bc. | |
... | Indefinite Directory: match any number of directory levels -- zero or more -- whatever it takes to make the rest of the pattern match. |
Patterns are used both for traditional filename wildcarding in word mode and for examining strings in expression mode. Patterns are nestable arbitrarily and a recursive comparison algorithm is used to guarantee a sensible result no matter how complex the pattern. For example: *r* or even *\[a-c]*.[ch] operate sensibly. Even drive letters can be wildcarded, e.g., *:winnt*.
Filename wildcards can be used wherever a word is expected and will match any filename except "." and ".." unless it's marked "hidden." (To allow wildcarding to match hidden files, set nonohidden = 1.) Quoting the word prvents wildcarding. Since filenames are not case sensitive, filename wildcarding isn't either.
A pattern can also be used to examine a string in a switch statement or with the "=~" (pattern matches) and "!~" (pattern fails) expression operators. In this context, the pattern must be inside quotes, since otherwise it would be parsed as an expression, with "*" being viewed as the multiply operator, etc. When examining a string with a pattern that uses alternation, the pattern "matches" if any of the alternatives matches. When matching strings, case does matter.
When using a pattern to examine a string with "=~" or "!~" or with a switch, the string being tested is the left operand and the pattern is on the right.
Previous Topic |
Next Topic
Hamilton C shell |
Free Updates |
Free Demo Software |
Win32 Training
Y2K |
Customer Testimonials |
On-line Hamilton C shell User Guide
Home |
Email |
Support |
Company Profile |
Distributors |
Links
Copyright © 1997-2001 by Hamilton Laboratories. All rights reserved.
You are visitor number
1358.
This page was last modified August 9, 2001.