A global expression pattern, or glob pattern, is a sort of string that can
be compared and matched against several other strings. The rules for a
global expression pattern are fairly simple. There exist two special
characters, "*" and "?". "*" can match zero or more characters of any kind
while "?" can match one, and only one, character of any kind. All other
characters match themselves. Some examples:
"Hello" matches "Hello" and only "Hello", e.g. not "hello".
"Hi?" matches all string with three letters than begin with "Hi", e.g.
"Him" and "His", but not "Hi" nor "Hiss".
"Hi*m" matches all strings that begin with "Hi" and ends with "m", e.g.
"Him" and "Hi mum".
"Hi?*m" matches all strings that begin with "Hi", ends with "m" and has
at least one character between "Hi" and "m".
"Hi*m*" matches all strings that begin with "Hi" and has an "m" in it.
Note!
|
It is not possible to escape the characters "*" and "?"
so that they match themselves. If you need to do such a match you have
to use a regular expression.
|