delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/12/04:44:29

Message-Id: <200008120844.EAA11828@delorie.com>
Date: Sat, 12 Aug 2000 11:47:13 +0200
To: meyering AT ascend DOT com
X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5b
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
CC: tr AT eth DOT net, djgpp-workers AT delorie DOT com, autoconf AT gnu DOT org
In-reply-to: <urysnsb4qia.fsf_-_@ixi.eng.ascend.com> (message from Jim
Meyering on 11 Aug 2000 20:11:25 +0200)
Subject: Re: portability of sed's \{0,1\}?
References: <Pine DOT LNX DOT 4 DOT 21 DOT 0007250651010 DOT 823-100000 AT midpec DOT com>
<200008110941 DOT CAA29407 AT drawbridge DOT ascend DOT com>
<uryem3w86ib DOT fsf AT ixi DOT eng DOT ascend DOT com>
<200008111728 DOT KAA12810 AT drawbridge DOT ascend DOT com> <urysnsb4qia DOT fsf_-_ AT ixi DOT eng DOT ascend DOT com>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Jim Meyering <meyering AT ascend DOT com>
> Date: 11 Aug 2000 20:11:25 +0200
> 
> "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il> writes:
> | > | Also, is \{0,1\} supported in all versions of
> | > |      Sed?
> | >
> | > I'm almost positive that it's not portable.
> |
> | Then what is the portable repacement for the ? operator (which isn't
> | part of the basic regexps, and therefore isn't supported by Sed)?
> 
> I'm not so sure now.
> I've tested on a pretty wide range of systems
> (did this: for i in $(type -a -p sed); do echo bc |$i 's/a\{0,1\}bc/x/';done)
> and it worked fine (printed `x') for each version of sed on each of those
> systems.

Accordng to my references, \{ and \} belong to the basic REs supported
by ed(1), and that's what Sed uses.

> I saw the earlier thread (on the autoconf list) on this topic where
> someone found that `?' and \| were not portable.

That's true: ? and \| are *not* part of BREs.  That's why I didn't use
? in the first place.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019