SPANL Creates a pattern matching the longest possible string containing characters that are in the specified string, range, or buffer. A pattern created with SPANL can match text containing line breaks. Syntax pattern := SPANL ({string | range | buffer} [, {FORWARD | REVERSE}]) Parameters string A string containing the characters that TPU is to match in the searched text. range A range containing the characters that TPU is to match in the searched text. buffer A buffer containing the characters that TPU is to match 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 not a member of the set of characters in the specified buffer, range, or string. Next, return to the first character that SPANL matched and start matching characters and line ends in the reverse direction until TPU finds a character not in the specified buffer, range, or string. You can specify REVERSE only if you are using SPANL 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 SPANL, you direct TPU not to stop matching in either direction until it has matched as many characters as possible. Comments SPANL matches one or more characters, each of which must appear in the string, range, or buffer passed as the parameter, and one or more line breaks. To match one or more line breaks and nothing else, specify a null string as a parameter to SPANL. Examples 1. pat1 := SPANL ("1234567890"); Creates a pattern matching any number and sequence of contiguous digits on one or more lines. 2. pat1 := SPANL ("1234567890", FORWARD); This statement has exactly the same effect as Example 1. 3. pat1 := SPANL (" "); Stores a pattern in the variable "pat1" matching the longest sequence of blank characters starting at the current character position and continuing to an end-of-search condition. 4. vowel_pattern := SPANL ('aeiouy', REVERSE); This statement defines the variable "vowel_pattern" to mean the longest string of characters that are all vowels. If you use the following statement: the_range := SEARCH (vowel_pattern, REVERSE); when the cursor is on the "a" in the word "liaison", then the variable "the_range" contains the string "iai". This is because when you use SPANL with REVERSE as the first element of a pattern, and then use that pattern in a reverse search, SPAN matches as many characters as possible in both the forward and reverse directions. If the cursor is on the "a" but you define the variable "vowel_pattern" without the REVERSE keyword, like this: vowel_pattern := SCAN ('aeiouy'); and then do a reverse search, "the_range" contains the string "ai", showing that the search matched from the starting point forward but did not return to the starting point to match backward as well. Related Topics ANCHOR ANY ARB MATCH NOTANY SCAN SCANL SEARCH SEARCH_QUIETLY SPAN UNANCHOR