Filename Generation: Operators and Qualifiers

The following strings are used to match filenames:
  *      Matches any string, including the null string.
  ?      Matches any 1 character.
  [...]  Matches any of the enclosed characters.
      - Ranges of characters can be specified by separating two chars with
        a '-'.
      - A ']' or a '-' may be matched by including it as the first character
        in the list.
      - There are several character classes that can be specified in the form
        [:CLASS:]. Note that the brackets are in ADDITION to the ones
        for specifying a range of characters.
      Here is a list of classes:
  	[:alnum:]   alphanumeric
  	[:alpha:]   alphabetic
  	[:blank:]   space or tab 
  	[:cntrl:]   control character
  	[:digit:]   decimal digit
  	[:graph:]   printable character except  whitespace
  	[:lower:]   lowercase letter
  	[:print:]   printable character
  	[:punct:]   printable character neither alphanumeric nor whitespace
  	[:space:]   whitespace character
  	[:upper:]   uppercase letter
  	[:xdigit:]  hexadecimal digit
    These use macros provided by the OS.
  [!...]	  Just like [...], but matches any character NOT in the set.
            Matches any number in the  range  x  to  y,  inclusive.
            Either  of the numbers may be omitted to make the range
            open-ended; hence `<->' matches any number.
            Matches the enclosed pattern.  This is used for  group-
  x|y  	  Matches either x or y.  This operator  has  lower  pre-
            cedence  than  any  other.   The  `|' character must be
            within parentheses, as in a grouped
  	  pattern above, to avoid interpretation as a  pipeline.
  ^x   (Requires EXTENDED_GLOB to be set.)   Matches  anything
            except  the  pattern  x.   This has a higher precedence
            than `/', so `^foo/bar' will search directories in  `.'
            except `./foo' for a file named `bar'
  x~y  (Requires EXTENDED_GLOB to  be  set.)   Match  anything
            that  matches the pattern x but does not match y.  This
            has lower precedence than any operator except  `|',  so
            `*/*~foo/bar'  will  search for all files in all direc-
            tories in `.'  and then exclude `foo/bar' if there  was
            such  a  match.   It  groups left-to-right, so multiple
            patterns can be  excluded  by  `foo~bar~baz'.   In  the
            exclusion pattern (y), `/' and `.' are not treated spe-
            cially the way they usually are in globbing.
  x#   (Requires EXTENDED_GLOB to be set.)   Matches  zero  or
            more  occurrences  of the pattern x.  This operator has
            high precedence; `12#' is equivalent to `1(2#)', rather
            than `(12)#'.
  x##  (Requires EXTENDED_GLOB to be  set.)   Matches  one  or
            more  occurrences  of the pattern x.  This operator has
            high precedence;  `12##'  is  equivalent  to  `1(2##)',
            rather than `(12)##'.


Perhaps you don't want every file returned by a match. For example, maybe you want directories omitted. Zsh offers an impressive number of qualifiers to limit what filenames are matched by a pattern. You should surround this list of qualifiers by parenthesis.

        /    directories
        .    plain files
        @    symbolic links
        =    sockets
        p    named pipes (FIFOs)
        *    executable plain files (0100)
        %    device files (character or block special)
        %b   block special files
        %c   character special files
        r    owner-readable files (0400)
        w    owner-writable files (0200)
        x    owner-executable files (0100)
        A    group-readable files (0040)
        I    group-writable files (0020)
        E    group-executable files (0010)
        R    world-readable files (0004)
        W    world-writable files (0002)
        X    world-executable files (0001)
        s    setuid files (04000)
        S    setgid files (02000)
        t    files with the sticky bit (01000)
        ddev files on the device dev
        files having a link count less than ct (-), greater than ct
        (+), or is equal to ct
        U    files owned by the effective user ID
        G    files owned by the effective group ID
        uid  files owned by user ID id if it is a number, if not, than the
             character after the `u' will be used as a separator and the
             string between it and the next matching separator (`(', `[', `{',
             and `<' match `)', `]', `}', and `>' respectively, any other
             character matches itself) will be taken as a user name, and the
             user ID of this user will be taken (e.g. `u:foo:' or `u[foo]' for
             user `foo')
        gid  like uid but with group IDs or names
             files accessed exactly n days ago.  Files accessed within the
             last n days are selected using a negative value for n (-n).
             Files accessed more than n days ago are selected by a positive n
             value (+n).  Optional unit specifiers `M', `w', `h' or `m' (e.g.
             `ah5') cause the check to be performed with months (of 30 days),
             weeks, hours, or minutes instead of days, respectively.  For
             instance, `echo *(ah-5)' would echo files accessed within the
             last five hours.
             like the file access qualifier, except that it uses the file
             modification time.
             like the file access qualifier, except that it uses the file
             inode change time.
             files less than n bytes (-), more than n bytes (+), or exactly n
             bytes in length. If this flag is directly followed by a `k'
             (`K'), `m' (`M'), or `p' (`P') (e.g. `Lk-50') the check is
             performed with kilobytes, megabytes, or blocks (of 512 bytes)
        ^    negates all qualifiers following it
        -    toggles between making the qualifiers work on symbolic links (the
             default) and the files they point to
        M    sets the MARK_DIRS option for the current pattern
        T    appends a traling qualifier mark to the file names, analogous to
             the LIST_TYPES option, for the current pattern (overrides M)
        N    sets the NULL_GLOB option for the current pattern
        D    sets the GLOB_DOTS option for the current pattern
        More than one of these lists can be combined, separated by commas. The
        whole list matches if at least one of the sublists matches (they are
        `or'ed, the qualifiers in the sublists are `and'ed).
        If a `:' appears in a qualifier list, the remainder of the expression
        in parenthesis is interpreted as a modifier (see the section
        `Modifiers' in the section `History Expansion').