From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13506 invoked by alias); 27 Jun 2012 07:26:57 -0000 Received: (qmail 13489 invoked by uid 22791); 27 Jun 2012 07:26:56 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jun 2012 07:26:44 +0000 From: "valery_reznic at yahoo dot com" To: glibc-bugs-regex@sources.redhat.com Subject: [Bug regex/14301] New: Regular expression wrong match with a number of groups Date: Wed, 27 Jun 2012 07:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: regex X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: valery_reznic at yahoo dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact glibc-bugs-regex-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-regex-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00000.txt.bz2 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.