TPUHELP.HLB  —  SCANL
  SCANL

     Returns a pattern matching the longest string that does not contain any
     of the characters the specified string, range, or buffer.  A pattern
     created with SCANL can match text containing line breaks.

     SCANL fails if it finds no characters other than those present in its
     argument.  SCAN succeeds if it finds at least one character not
     specified in the first parameter.

  Syntax

     pattern := SCANL ({string | range | buffer} [, {FORWARD | REVERSE}])

  Parameters

     string               A string containing the characters that cause
                          TPU to stop matching characters in the searched
                          text.

     range                A range containing the characters that cause
                          TPU to stop matching characters in the searched
                          text.

     buffer               A buffer containing the characters that cause
                          TPU to stop matching characters in the searched
                          text.

     FORWARD              A keyword directing TPU to match characters in
                          the forward direction.

     REVERSE              A keyword directing TPU to match characters as
                          follows:  First, match characters in the forward
                          direction until TPU finds a character that is a
                          member of the set of characters in the specified
                          buffer, range, or string.  Next, return to the
                          first character that SCANL matched and start
                          matching characters and line breaks in the reverse
                          direction until TPU finds a character in the
                          specified buffer, range, or string.  You can
                          specify REVERSE only if you are using SCANL in the
                          first element of a pattern being used in a reverse
                          search.  In other contexts, specifying REVERSE has
                          no effect.

                          The behavior enabled by REVERSE allows an
                          alternate form of reverse search.  By default, a
                          reverse search stops as soon as a successful match
                          occurs, even if there might have been a longer
                          successful match in the reverse direction.  By
                          specifying REVERSE with SCANL, you direct TPU
                          not to stop matching in either direction until it
                          has matched as many characters as possible.

  Examples

     1.  The following assignment statement creates a pattern that matches a
         sentence.  It assumes that a sentence ends in a period, exclamation
         mark, or question mark.  It also assumes that a sentence contains
         at least two letters.  The matched text does not include the
         punctuation mark.

         sentence_pattern := ANY ("ABCDEFGHIJKLMNOPQRSTUVWXYZ") + SCANL
         (".!?");

     2.  pat1 := SCANL ('abc');

         This assignment statement stores in "pat1" a pattern that matches
         the longest string of characters that does not contain an a, b, or
         c.

     3.  pat1 := SCANL ('abc', FORWARD);

         This statement has exactly the same effect as Example 1.

     4.  word := SCANL (' ', REVERSE);

         This statement defines the variable "word" to mean the longest
         consecutive string of characters that does not include a space
         character.  If you use the following statement:

         the_range := SEARCH (word, REVERSE);

         when the cursor is on the "n" in Xanadu in the following text:

         "In Xanadu did Kublai Khan a stately pleasure dome decree"

         then the variable "the_range" contains the word "Xanadu".  This is
         because when you use SCANL with REVERSE as the first element of a
         pattern, and then use that pattern in a reverse search, SCANL
         matches as many characters as possible in both the forward and
         reverse directions.

         If the cursor is on "n" but you define the variable "word" without
         the REVERSE keyword, like this:

         word := SCANL (' ');

         and then do a reverse search, "the_range" contains the characters
         "nadu".

  Related Topics

  ANCHOR     ANY             ARB      MATCH     NOTANY     SCAN
  SEARCH     SEARCH_QUIETLY  SPAN     SPANL     UNANCHOR
Close Help