![]() |
Section 8.17.3.11: |
![]() |
This class provides POSIX-style string pattern matching. It provides a matches operation to find out if a test string matches the extended regular expression.
An extended regular expression consists of one or more of the following kinds of components :-
NOTE | The syntax of extended regular expressions is defined in the POSIX standard ISO/IEC 9945-2:1995 to which reference should be made in understanding the regular expression mechanism. |
The following features are required to be implemented for this class in accordance with the specifications given in $BINARY :-
This creation routine checks that the argument is a valid extended regular expression and returns it if it is, otherwise the argument returned is an indicative error message.
create | ( |
inout | str : STR |
) : SAME |
This formal signature uses a tuple for the result, the implementation being required to set the string component of that as the inout argument.
Since this is a creation routine, the pre-condition is vacuously true.
This routine creates a new regular expression pattern object unless an error has been detected, when void is returned and the string inout parameter is an error message indicating the problem.
This predicate returns true of the given string matches self. Note that if self and the string have different encodings then a match is identically false.
Since this routine is a predicate, the post-condition is vacuously true.
This predicate returns true if and only if the given string matches self.
This second variant of the matching predicate takes a string cursor, moving the cursor position to the end of the matched string if successful.
matches | ( |
test_cursor : STR_CURSOR | |
) : BOOL |
This predicate returns true if and only if self matches the test cursor, starting at the current buffer position. If a match is found, the cursor is positioned at the end of the longest matching string found.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Text Index |
Comments or enquiries should be made to
Keith
Hopper. Page last modified: Thursday, 23 November 2000. |
![]() |