This is the mail archive of the
glibc-bugs-regex@sourceware.org
mailing list for the glibc project.
[Bug regex/14301] New: Regular expression wrong match with a number of groups
- From: "valery_reznic at yahoo dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs-regex at sources dot redhat dot com
- Date: Wed, 27 Jun 2012 07:26:16 +0000
- Subject: [Bug regex/14301] New: Regular expression wrong match with a number of groups
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=14301
Bug #: 14301
Summary: Regular expression wrong match with a number of groups
Product: glibc
Version: 2.11
Status: NEW
Severity: normal
Priority: P2
Component: regex
AssignedTo: unassigned@sourceware.org
ReportedBy: valery_reznic@yahoo.com
CC: drepper.fsp@gmail.com
Classification: Unclassified
Created attachment 6487
--> http://sourceware.org/bugzilla/attachment.cgi?id=6487
test program for bug demonstration
I compile regular expression with REG_EXTENDED | REG_ICASE (see attached
program)
Then run it as following:
(First parameter - regular expression, second - text to match)
1. ./r '[ ](4[0-9]{15})|(4[0-9]{12})[ ]' ' 4123456789012 ' - match
2. ./r '[ ](4[0-9]{15})|(4[0-9]{12})[ ]' 'r4123456789012' - no match
3. ./r '[ ](4[0-9]{15})|(4[0-9]{12})|(AAA)[ ]' 'r4123456789012' - match
4. ./r '[ ](4[0-9]{12})|(4[0-9]{15})|(AAA)[ ]' 'r4123456789012' - no-match
1. Match, as expected - second group (4[0-9]{12})
2. No, match as expected.
3. Match, when should not be
4. Just for interest - swap second and first group 4[0-9]{12} and 4[0-9]{15}
and all of sudden it works as expected.
Attached program can be compiled with
gcc -Wall r.c -o r
I tested it on systems with following glibc versions:
- 2.3.2 Fedora Core 1, both i386 and x86-64
- 2.11 Fedora 12 - x86-64
- 2.5 CentOS release 5.6 (Final) - i386
--
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.