Revision 7.10
2/28/2012
subexpressions exist at that point in the regular expression, otherwise the parser will drop
digits until the number is smaller or equal to the existing number of groups or it is one
digit.
Perl uses the
g
flag to request a match that resumes where the last match left off. This
functionality is provided implicitly by the
class: Repeated invocations of the
method will resume where the last match left off, unless the matcher is reset.
In Perl, embedded flags at the top level of an expression affect the whole expression. In
this class, embedded flags always take effect at the point at which they appear, whether
they are at the top level or within a group; in the latter case, flags are restored at the end
of the group just as in Perl.
Perl is forgiving about malformed matching constructs, as in the expression
*a
, as well as
dangling brackets, as in the expression
abc]
, and treats them as literals. This class also
accepts dangling brackets but is strict about dangling metacharacters like +, ? and *, and
will throw a
if it encounters them.
For a more precise description of the behavior of regular expression constructs, please see
Mastering Regular Expressions, 2nd Edition
, Jeffrey E. F. Friedl, O'Reilly and Associates, 2002.
Page 218 of 228