Compaq DEC Text Processing Utility AA-PWCBD-TE User Manual
Page 55
DEC Text Processing Utility Data Types
3.7 Pattern Data Type
pat1 := "abc" + (arb(2) @ var1) + remain;
SEARCH or SEARCH_QUIETLY also assigns to var1 a range that contains the
text de.
If you assign to a variable a partial pattern that matches a position, rather
than a character, the partial pattern variable is a range that contains the
character or line-end at the point in the file where the partial pattern was
matched. For example, in any of the following patterns that contain partial
pattern assignments, the variable partial_pattern_variable contains the character
or line-end at the point in the file where the partial pattern was matched:
•
""
@ partial_pattern_variable
•
ANCHOR @ partial_pattern_variable
•
UNANCHOR @ partial_pattern_variable
•
LINE_BEGIN @ partial_pattern_variable
•
BUFFER_BEGIN @ partial_pattern_variable
If you use one of the preceding patterns when the cursor is free (that is, in an
area that does not contain text, such as the area after the end of a line), the
variable partial_pattern_variable contains the line-end or character nearest to the
cursor.
SEARCH or SEARCH_QUIETLY does partial pattern assignment only if the
complete pattern matches. If the complete pattern matches, it makes assignments
only to those variables paired with pattern elements that are used in the complete
match. If a partial pattern assignment variable appears more than once in a
pattern in places where it is legal for a partial pattern assignment to occur, the
last occurrence in the pattern determines what range SEARCH assigns to the
variable. For example, with the search text abcdefg and the following pattern,
SEARCH or SEARCH_QUIETLY returns a range that contains the text abcde
and assigns a range that contains the text d to the variable var1:
pat1 := "a" + ("b" @ var1) + "c" + ("d" @ var1)
+ ("e" | ("x" @ var1));
3.7.3.5 Relational Operators
You can use the two relational operators, equal ( = ) and not equal (<>), to compare
patterns. Two patterns are equal if they are the same pattern, as pat1 and pat2
are in the following example:
pat1 := notany("abc", 2) + span("123");
pat2 := pat1;
Two patterns are also equal if they have the same internal representation.
Patterns have the same internal representation only if they are built in exactly
the same way. The order of the characters in the arguments to ANY, NOTANY,
SCAN, SCANL, SPAN, and SPANL does not matter when you are comparing
patterns returned by any of these built-ins. Other than this, almost any
difference in the building of two patterns makes those patterns unequal. For
example, suppose you defined the variable this_pat as follows:
this_pat := ANY ("abc");
DEC Text Processing Utility Data Types 3–15