Article View: comp.bugs.sys5
Article #124s/A*./B/g editor bug?
From: 9704
Date: Wed, 18 Oct 1989 01:17
Date: Wed, 18 Oct 1989 01:17
28 lines
1468 bytes
1468 bytes
I've noticed the ED s///g command works incorrectly when given the command
s/b*a/c/g
on the input line
aaaaaaaaaaaaaaaaaaaaa
-- the result is:
cacacacacacacacacacac
and it should be:
ccccccccccccccccccccc
This is incorrect according to ED(1):
(.,.)s/RE/replacement/g
The substitute command searches each
addressed line for an occurrence of the
specified RE. In each line in which a
match is found, ALL (NON-OVERLAPPED)
matched strings are replaced by the
replacement if the global replacement
indicator g appears after the command.
These occurrences ARE non-overlapping. The form s/ab*/c/g works as expected.
Both VI and ED behave this way, on at least System V.2 and Ultrix-32 V3.1.
Is this a confirmed bug in the RE matcher or the substitute code, and has
it been resolved? This sounds trivial, but it did cause real problems.
-- Greg Ubben
bink@aplcen.apl.jhu.edu
...!uunet!mimsy!aplcen!bink
Technical Details
Message-ID:
<3522@aplcen.apl.jhu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!binkShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!aplcen!bink From: bink@aplcen.apl.jhu.edu (9704) Newsgroups: comp.bugs.sys5 Subject: s/A*./B/g editor bug? Message-ID: <3522@aplcen.apl.jhu.edu> Date: 18 Oct 89 01:17:28 GMT Organization: The Johns Hopkins University, Baltimore MD Lines: 28