Previous: The Match-zero-or-one Operator (?
or \?
), Up: Repetition Operators [Contents][Index]
{
… }
or \{
… \}
)If the syntax bit RE_INTERVALS
is set, then Regex recognizes
interval expressions. They repeat the smallest possible preceding
regular expression a specified number of times.
If the syntax bit RE_NO_BK_BRACES
is set, ‘{’ represents
the open-interval operator and ‘}’ represents the
close-interval operator ; otherwise, ‘\{’ and ‘\}’ do.
Specifically, supposing that ‘{’ and ‘}’ represent the open-interval and close-interval operators; then:
{count}
matches exactly count occurrences of the preceding regular expression.
{min,}
matches min or more occurrences of the preceding regular expression.
{min, max}
matches at least min but no more than max occurrences of the preceding regular expression.
The interval expression (but not necessarily the regular expression that contains it) is invalid if:
RE_DUP_MAX
(which symbol regex.h
defines).
If the interval expression is invalid and the syntax bit
RE_NO_BK_BRACES
is set, then Regex considers all the
characters in the would-be interval to be ordinary. If that bit
isn’t set, then the regular expression is invalid.
If the interval expression is valid but there is no preceding regular
expression on which to operate, then if the syntax bit
RE_CONTEXT_INVALID_OPS
is set, the regular expression is invalid.
If that bit isn’t set, then Regex considers all the characters—other
than backslashes, which it ignores—in the would-be interval to be
ordinary.
Previous: The Match-zero-or-one Operator (?
or \?
), Up: Repetition Operators [Contents][Index]