class GLOB
Unix "glob"-style string patterns are what the various shells in Unix use to specify sets of file names. They are used in the Sather interpreter to specify class names, etc. This class takes a pattern string and a test string and determines whether the test string matches the pattern.
Here are the components of a glob pattern:
1) char Any pattern character except for the special characters "[{?*\" must be matched exactly in the text string.
2) '\' char The backslash character is used as an escape to enable matching of the special characters. The backslash may be followed by any character and the pattern matches that character.
3) '[' ... ']' If the left bracket character '[' appears unescaped, then it must be followed by a sequence of characters and a right bracket. This pattern matches any single character in the list. If a right bracket appears immediately after the left bracket, it is treated as an ordinary character rather than as the closing bracket. All characters between the two brackets except '-' are taken to be themselves (i.e. they aren't special or escaped). Sequences of the form "char1 '-' char2" are treated as a shorthand for a list of all the characters alphabetically between "char1" and "char2". '-' may be included in the set by making it the first or last character.
3) '{' str, str, ... '}' If the left brace character '{' appears unescaped, then it must be followed by a comma-separated list of strings. Nothing is escaped
4) '?' A question mark matches an arbitrary single character.
5) '*' An asterisk matches zero or more arbitrary characters.

Flattened version is here


**** Void if `s' is a legal pattern string, an error message if not.
**** True if the glob pattern `pat' matches the string `s'.
**** True if the pattern `pat' starting at character `pst' matches the string `s' starting at character `sst'.

The Sather Home Page