HP 3000 Manuals

Expression Closure (Match Zero or More of the Previous Expression) [ System Debug Reference Manual ] MPE/iX 5.0 Documentation


System Debug Reference Manual

Expression Closure (Match Zero or More of the Previous Expression) 

Any regular expression that matches a single character (that is,
everything but "^" and "$") can be followed by the character "*" to make
a regular expression that matches zero or more successive occurrences of
the single character pattern.  The resulting expression is called a
closure.  For example, "x*" matches zero or more x's; "xx*" matches one
or more "x's"; "[a-z]*" matches any string of zero or more lowercase
letters.  If there is a choice of the number of characters to be matched,
the longest possible string is used even when a match with the null
string is equally valid.  "[a-zA-Z]*" matches an entire word (which may
be a null string); "[a-zA-Z][a-zA-Z]*" matches at least an entire word
(one or more letters but not a null string); and ".*" matches a whole
line (which may be a null string).  Any ambiguity in deciding which part
of a line matches an expression is resolved by choosing the match
beginning with the leftmost character, then choosing the longest possible
match at the point.  So "[a-zA-Z][a-zA-Z0-9_]*" matches the leftmost
Pascal identifier on a line, "(.*)" matches anything between parentheses
(not necessarily balanced), and "..*" matches an entire line of one or
more characters but not a null string.



MPE/iX 5.0 Documentation