Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Nov 2019 22:15:50 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 242013] matching back references works only some of the time
Message-ID:  <bug-242013-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D242013

            Bug ID: 242013
           Summary: matching back references works only some of the time
           Product: Base System
           Version: 12.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: khellman@mcprogramming.com

Matching back references according to re_format(7):

     Finally, there is one new type of atom,
     a back reference: =E2=80=98\=E2=80=99 followed by a non-zero decimal d=
igit d matches the
     same sequence of characters matched by the dth parenthesized
     subexpression (numbering subexpressions by the positions of their open=
ing
     parentheses, left to right), so that (e.g.)  =E2=80=98\([bc]\)\1=E2=80=
=99 matches =E2=80=98bb=E2=80=99 or
     =E2=80=98cc=E2=80=99 but not =E2=80=98bc=E2=80=99.

does not always seem to work.  For instance, I would expect all of these=20
to print the single input line:

$ echo '#20#20' | sed -n -E -e '/(#|0x)(..)\1\2/p'
$ echo '#2020#' | sed -n -E -e '/(#|0x)(..)\2\1/p'
$ echo '#202020' | sed -n -E -e '/(#|0x)(..)20\2/p'
#202020
$ echo '#202020' | sed -n -E -e '/(#|0x)(..)\2(20)/p'
$ echo '#202020' | sed -n -E -e '/(#|0x)(..)(20)\2/p'
#202020
$ echo '#202020' | sed -n -E -e '/(#|0x)(..)..\2/p'
#202020
$ echo '#20#20' | sed -n -E -e '/(#|0x)(..).\2/p'
#20#20

Additionally, gsed(1) equivalent invocations work as expected.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-242013-227>