delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/11/14:12:28

X-Authentication-Warning: ixi.eng.ascend.com: meyering set sender to meyering AT ascend DOT com using -f
Sender: meyering AT ascend DOT com
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: tr AT eth DOT net, djgpp-workers AT delorie DOT com
Cc: autoconf AT gnu DOT org
Subject: 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>
From: Jim Meyering <meyering AT ascend DOT com>
In-Reply-To: "Eli Zaretskii"'s message of "Fri, 11 Aug 2000 20:39:18 +0200"
Date: 11 Aug 2000 20:11:25 +0200
Message-ID: <urysnsb4qia.fsf_-_@ixi.eng.ascend.com>
Lines: 21
User-Agent: Gnus/5.0807 (Gnus v5.8.7) Emacs/20.6.92
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

"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.

I tested on a few flavors of Suns (sunos4.1.4, 5.5.1, 5.6, 5.7),
HPUX 10.20, Linux, irix 6.2 & 6.5, NetBSD 1.3.1, AIX 2.4.

I saw the earlier thread (on the autoconf list) on this topic where
someone found that `?' and \| were not portable.  Has anyone found a
system on which \{m,n\} is not portable?

- Raw text -


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