45
46
* o ? matches one character
46
47
* o \ will escape a special character
47
48
* o $ matches the end of the string
48
* o [abc] matches one occurence of a, b, or c. The only character that needs
49
* to be escaped in this is ], all others are not special.
50
* o [a-z] matches any character between a and z
51
* o [^az] matches any character except a or z
52
* o ~ followed by another shell expression will remove any pattern
53
* matching the shell expression from the match list
54
* o (foo|bar) will match either the substring foo, or the substring bar.
55
* These can be shell expressions as well.
49
* Bracketed expressions:
50
* o [abc] matches one occurence of a, b, or c.
51
* o [^abc] matches any character except a, b, or c.
52
* To be matched between [ and ], these characters must be escaped: \ ]
53
* No other characters need be escaped between brackets.
54
* Unnecessary escaping is permitted.
55
* o [a-z] matches any character between a and z, inclusive.
56
* The two range-definition characters must be alphanumeric ASCII.
57
* If one is upper case and the other is lower case, then the ASCII
58
* non-alphanumeric characters between Z and a will also be in range.
59
* o [^a-z] matches any character except those between a and z, inclusive.
60
* These forms cannot be combined, e.g [a-gp-z] does not work.
62
* As a top level, outter-most expression only, the expression
63
* foo~bar will match the expression foo, provided it does not also
64
* match the expression bar. Either expression or both may be a union.
65
* Except between brackets, any unescaped ~ is an exclusion.
66
* At most one exclusion is permitted.
67
* Exclusions cannot be nested (contain other exclusions).
68
* example: *~abc will match any string except abc
70
* (foo|bar) will match either the expression foo, or the expression bar.
71
* At least one '|' separator is required. More are permitted.
72
* Expressions inside unions may not include unions or exclusions.
73
* Inside a union, to be matched and not treated as a special character,
74
* these characters must be escaped: \ ( | ) [ ~ except when they occur
75
* inside a bracketed expression, where only \ and ] require escaping.
57
77
* The public interface to these routines is documented below.