[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #21199] odd output for some patterns combining backreference, alter
From: |
Alex Lamey |
Subject: |
[bug #21199] odd output for some patterns combining backreference, alternation, and repetition |
Date: |
Sun, 30 Sep 2007 20:03:13 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7 |
URL:
<http://savannah.gnu.org/bugs/?21199>
Summary: odd output for some patterns combining
backreference, alternation, and repetition
Project: grep
Submitted by: lexlamey
Submitted on: Sunday 09/30/2007 at 20:03
Category: None
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I think grep (2.5.1) is misbehaving on me. Here are twelve examples, wherein
I apply six patterns (differing only in the repetition argument) to two inputs
(differing only in their fifth character). Five of the outputs (marked '!')
seem to be wrong to me. But I'm quite new to grep so maybe I've misunderstood
something.
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-88
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
88-88
!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){4}'
88-8
!!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){5}'
88-88
!
$ echo 88-88 | egrep -o '([0-9])([0-9])-(\1|\2){6}'
88-88
!
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){1}'
88-8
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){2}'
88-8
!
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){3}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){4}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){5}'
$ echo 88-81 | egrep -o '([0-9])([0-9])-(\1|\2){6}'
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?21199>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #21199] odd output for some patterns combining backreference, alternation, and repetition,
Alex Lamey <=