public inbox for glibc-bugs-regex@sourceware.org
help / color / mirror / Atom feed
From: "valery_reznic at yahoo dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-14301-132@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-06-27  7:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27  7:26 valery_reznic at yahoo dot com [this message]
2012-06-27  7:48 ` [Bug regex/14301] " schwab@linux-m68k.org
2012-06-27  8:16 ` valery_reznic at yahoo dot com
2012-06-27  8:33 ` fweimer at redhat dot com
2012-06-27  8:51 ` valery_reznic at yahoo dot com
2014-06-13 14:58 ` fweimer at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14301-132@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs-regex@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).