This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regex/13396] curly is treated as a range in cases where POSIX says it should not be


http://sourceware.org/bugzilla/show_bug.cgi?id=13396

Paolo Bonzini <bonzini at gnu dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Paolo Bonzini <bonzini at gnu dot org> 2011-11-10 06:39:04 UTC ---
Here is the description of ranges for BRE:

    When a BRE matching a single character, a subexpression, or a
back-reference is followed by an interval expression of the format "\{m\}",
"\{m,\}", or "\{m,n\}", together with that interval expression it shall match
what repeated consecutive occurrences of the BRE would match. The values of m
and n are decimal integers in the range 0 <= m<= n<= {RE_DUP_MAX}, where m
specifies the exact or minimum number of occurrences and n specifies the
maximum number of occurrences. The expression "\{m\}" shall match exactly m
occurrences of the preceding BRE, "\{m,\}" shall match at least m occurrences,
and "\{m,n\}" shall match any number of occurrences between m and n, inclusive.

    For example, in the string "abababccccccd" the BRE "c\{3\}" is matched by
characters seven to nine, the BRE "\(ab\)\{4,\}" is not matched at all, and the
BRE "c\{1,3\}d" is matched by characters ten to thirteen.

---

Here is the description for ERE:

When an ERE matching a single character or an ERE enclosed in parentheses is
followed by an interval expression of the format "{m}", "{m,}", or "{m,n}",
together with that interval expression it shall match what repeated consecutive
occurrences of the ERE would match. The values of m and n are decimal integers
in the range 0 <= m<= n<= {RE_DUP_MAX}, where m specifies the exact or minimum
number of occurrences and n specifies the maximum number of occurrences. The
expression "{m}" matches exactly m occurrences of the preceding ERE, "{m,}"
matches at least m occurrences, and "{m,n}" matches any number of occurrences
between m and n, inclusive.

For example, in the string "abababccccccd" the ERE "c{3}" is matched by
characters seven to nine and the ERE "(ab){2,}" is matched by characters one to
six.

---

The two are the same except for \.  The citation I provided is just an example
not restricted to either BRE or ERE.  Thus POSIX could have said equivalently

the ERE construct "{1,2,3}" does not comply with the grammar. A
conforming application cannot rely on it producing an error nor matching the
literal characters "{1,2,3}"

and it would have applied to BRE and ERE just the same.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]