The rules are as follows (POSIX.2, 3.13).
.SH "WILDCARD MATCHING"
A string is a wildcard pattern if it contains one of the
-characters `?', `*' or `['. Globbing is the operation
+characters `?', `*' or `['.
+Globbing is the operation
that expands a wildcard pattern into the list of pathnames
-matching the pattern. Matching is defined by:
+matching the pattern.
+Matching is defined by:
A `?' (not between brackets) matches any single character.
namely any of the characters enclosed by the brackets.
The string enclosed by the brackets cannot be empty;
therefore `]' can be allowed between the brackets, provided
-that it is the first character. (Thus, `[][!]' matches the
-three characters `[', `]' and `!'.)
+that it is the first character.
+(Thus, `[][!]' matches the three characters `[', `]' and `!'.)
.SS Ranges
There is one special convention:
two characters separated by `\-' denote a range.
Thus, `[[?*\e]' matches the four characters `[', `?', `*' and `\e'.
.SH PATHNAMES
Globbing is applied on each of the components of a pathname
-separately. A `/' in a pathname cannot be matched by a `?' or `*'
-wildcard, or by a range like `[.\-0]'. A range cannot contain an
+separately.
+A `/' in a pathname cannot be matched by a `?' or `*'
+wildcard, or by a range like `[.\-0]'.
+A range cannot contain an
explicit `/' character; this would lead to a syntax error.
If a filename starts with a `.', this character must be matched explicitly.
.SH "EMPTY LISTS"
The nice and simple rule given above: `expand a wildcard pattern
into the list of matching pathnames' was the original Unix
-definition. It allowed one to have patterns that expand into
+definition.
+It allowed one to have patterns that expand into
an empty list, as in
.br
.nf
one can force the classical behaviour by setting
.IR allow_null_glob_expansion=true .
-(Similar problems occur elsewhere. E.g., where old scripts have
+(Similar problems occur elsewhere.
+E.g., where old scripts have
.br
.nf
rm `find . \-name "*~"`
.SH NOTES
.SS Regular expressions
Note that wildcard patterns are not regular expressions,
-although they are a bit similar. First of all, they match
+although they are a bit similar.
+First of all, they match
filenames, rather than text, and secondly, the conventions
are not the same: e.g., in a regular expression `*' means zero or
more copies of the preceding thing.
for "any lowercase letter".
Some Unix implementations generalized this so that a range X\-Y
stands for the set of characters with code between the codes for
-X and for Y. However, this requires the user to know the
+X and for Y.
+However, this requires the user to know the
character coding in use on the local system, and moreover, is
not convenient if the collating sequence for the local alphabet
differs from the ordering of the character codes.
both for wildcard patterns and for regular expressions.
In the above we saw three types of items that can occur in a bracket
expression: namely (i) the negation, (ii) explicit single characters,
-and (iii) ranges. POSIX specifies ranges in an internationally
+and (iii) ranges.
+POSIX specifies ranges in an internationally
more useful way and adds three more types:
(iii) Ranges X\-Y comprise all characters that fall between X
(v) Collating symbols, like `[.ch.]' or `[.a-acute.]',
where the string between `[.' and `.]' is a collating
-element defined for the current locale. Note that this may
+element defined for the current locale.
+Note that this may
be a multi-character element.
(vi) Equivalence class expressions, like `[=a=]',
where the string between `[=' and `=]' is any collating
element from its equivalence class, as defined for the
-current locale. For example, `[[=a=]]' might be equivalent
+current locale.
+For example, `[[=a=]]' might be equivalent
to `[aáàäâ]' (warning: Latin-1 here), that is,
to `[a[.a-acute.][.a-grave.][.a-umlaut.][.a-circumflex.]]'.
.SH "SEE ALSO"