     Regular Expressions

     The patterns used in article searching are regular expressions such as
     those used by ed(1).  In addition, \w matches an alphanumeric character
     and \W a non-alphanumeric.  Word boundaries may be matched by \b, and
     non-boundaries by \B.  The bracketing construct \( ... \) may also be
     used, and \digit matches the digit'th substring, where digit can range
     from 1 to 9.  \0 matches whatever the last bracket match matched.  Up to
     10 alternatives may given in a pattern, separated by \|, with the caveat
     that \( ... \| ... \) is illegal.

     Interpretation and Interpolation

     Many of the strings that trn handles are subject to interpretations of
     several types.  Under filename expansion, an initial "~/" is translated
     to the name of your home directory, and "~name" is translated to the
     login directory for the user specified.  Filename expansion will also
     expand an initial environment variable, and also does the backslash,
     caret and percent expansion mentioned below.

     All interpreted strings go through backslash, caret and percent
     interpretation.  The backslash escapes are the normal ones (such as \n,
     \t, \033, etc.).  The caret escapes indicate control codes (such as ^i,
     ^l, etc.).  If you wish to pass through a backslash or a caret it must
     be escaped with a backslash.  The special percent escapes are similar to
     printf percent escapes.  These cause the substitution of various run-
     time values into the string.  The following are currently recognized:

     %a      Current article number.

     %A      Full name of current article (%P/%c/%a).

     %b      Destination of last save command, often a mailbox.

     %B      The byte offset to the beginning of the part of the article to
             be saved, set by the save command.  The 's' and 'S' commands set
             it to 0, and the 'w' and 'W' commands set it to the byte offset
             of the body of the article.

     %c      Current newsgroup, directory form.

     %C      Current newsgroup, dot form.

     %d      Full name of newsgroup directory (%P/%c).

     %D      "Distribution:" line from the current article.

     %e      The last command executed to extract data from an article.

     %E      The last directory where an extracted file went.

     %f      "From:" line from the current article, or the "Reply-To:" line
             if there is one.  This differs from %t in that comments (such as
             the full name) are not stripped out with %f.

     %F      "Newsgroups:" line for a new article, constructed from "News-
             groups:" and "Followup-To:" lines of current article.

     %h      Name of the header file to pass to the mail or news poster, con-
             taining all the information that the poster program needs in the
             form of a message header.  It may also contain a copy of the
             current article.  The format of the header file is controlled by
             the MAILHEADER and NEWSHEADER environment variables.

     %H      Host name (your machine's name).

     %i      "Message-I.D.:" line from the current article, with <>
             guaranteed.

     %I      The reference indication mark (see the -F switch.)

     %l      The news administrator's login name, if any.

     %L      Login name (yours).

     %m      The current mode of trn, for use in conditional macros.

                  i    Initializing.
                  n    Newsgroup-selection level.
                  f    end (Finis) of newsgroup-selection level.
                  t    the Thread/subject/article selector.
                  a    Article level (What next?).
                  e    End of the article level.
                  p    Pager level (MORE prompt).
                  u    Set-unread prompt.
                  d    selector moDe prompt.
                  o    selector Order prompt.
                  m    Memorize thread command prompt.
                  r    memoRize subject command prompt.
                  k    processing memorized (KILL file) commands.
                  A    Add this newsgroup?
                  B    aBandon confirmation.
                  C    Catchup confirmation.
                  D    Delete bogus newsgroups?
                  F    Is follow-up a new topic?
                  M    Use mailbox format?
                  R    Resubscribe to this newsgroup?

             Note that yes/no questions are all upper-case modes.  If, for
             example, you wanted to disallow defaults on all yes/no ques-
             tions, you could define the following macro:

             \040 %(%m=[A-Z]?h: )

     %M      The number of articles marked to return via the 'M' command.  If
             the same article is Marked multiple times, "%M" counts it multi-
             ple times in the current implementation.

     %n      "Newsgroups:" line from the current article.

     %N      Full name (yours).

     %o      Organization (yours).

     %O      Original working directory (where you ran rn from).

     %p      Your private news directory, normally ~/News.

     %P      Public news spool directory, normally /usr/spool/news on systems
             that don't use NNTP.

     %r      Last reference on references line of current article (parent
             article id).

     %R      References list for a new article, constructed from the refer-
             ences and article ID of the current article.

     %s      Subject, with all Re's and (nf)'s stripped off.

     %S      Subject, with one "Re:" stripped off.

     %t      "To:" line derived from the "From:" and "Reply-To:" lines of the
             current article.  This always returns an Internet format
             address.

     %T      "To:" line derived from the "Path:" line of the current article
             to produce a uucp path.

     %u      The number of unread articles in the current newsgroup.

     %U      The number of unread articles in the current newsgroup, not
             counting the the current article.  When threads are selected,
             this count reflects only selected articles.

     %v      The number of unselected articles, not counting the current
             article if it is unselected.

     %w      The directory where mthreads keeps its tmp files.

     %W      The directory where thread files are placed.

     %x      The news library directory.

     %X      The rn library directory.

     %z      The length of the current article in bytes.

     %Z      The number of selected threads.

     %~      Your home directory.

     %.      The directory containing your dot files, which is your home
             directory unless the environment variable DOTDIR is defined when
             rn is invoked.

     %#      The current count for a multi-file save, starting with 1.  This
             value is incremented by one for each file saved or extracted
             within a single command.

     %$      Current process number.

     %/      Last search string.

     %?      A space unless the current interp string is > 79 characters, at
             which point it turns into a newline.

     %%      A percent sign.

     %{name} or %{name-default}
             The environment variable "name".

     %[name] The value of header line "Name:" from the current article.  The
             "Name: " is not included.  For example "%D" and "%[distribu-
             tion]" are equivalent.  The name must be spelled out in full.

     %`command`
             Inserts the output of the command, with any embedded newlines
             translated to space.

     %"prompt"
             Prints prompt on the terminal, then inputs one string, and
             inserts it.

     %(test_text=pattern?then_text:else_text)
             If test_text matches pattern, has the value then_text, otherwise
             else_text.  The ":else_text" is optional, and if absent, inter-
             polates the null string.  The = may be replaced with != to
             negate the test.  To quote any of the meta-characters ('=', '?',
             ':', or ')'), precede with a backslash.

     %digit  The digits 1 through 9 interpolate the string matched by the nth
             bracket in the last pattern match that had brackets.  If the
             last pattern had alternatives, you may not know the number of
             the bracket you want -- %0 will give you the last bracket
             matched.

     Modifiers: to capitalize the first letter, insert '^': "%^C" produces
     something like "Rec.humor".  Inserting '_' causes the first letter fol-
     lowing the last '/' to be capitalized: "%_c" produces "rec/Humor".

     Inserting '\' will insert a backslash before any characters that would
     be magic in a regular expression, including '%': "%\C" produces
     "rec\.humor".

     Inserting ":FMT" will format the result according to the printf-style
     FMT string: "%:-50.50s" left-justifies the subject into a 50 character
     field.

     In multi-character commands such as '!', 's', '/', etc, you can interpo-
     late various run-time values by typing escape and a character.  To find
     out what you can interpolate, type escape and 'h', or check out the sin-
     gle character % substitutions for environment variables in the Interpre-
     tation and Interpolation section, which are the same.  Additionally,
     typing a double escape will cause any % substitutions in the string
     already typed in to be expanded.
