From owner-freebsd-questions@FreeBSD.ORG Mon Dec 6 01:15:28 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26642106566C for ; Mon, 6 Dec 2010 01:15:28 +0000 (UTC) (envelope-from ws@au.dyndns.ws) Received: from ipmail04.adl6.internode.on.net (ipmail04.adl6.internode.on.net [150.101.137.141]) by mx1.freebsd.org (Postfix) with ESMTP id AA8558FC18 for ; Mon, 6 Dec 2010 01:15:27 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApEBAEPC+0yWZWdv/2dsb2JhbAAH4VCFSQQ Received: from ppp103-111.static.internode.on.net (HELO [192.168.1.144]) ([150.101.103.111]) by ipmail04.adl6.internode.on.net with ESMTP; 06 Dec 2010 11:29:38 +1030 From: Wayne Sierke To: Chip Camden In-Reply-To: <20101205181945.GC39513@libertas.local.camdensoftware.com> References: <20101205002602.GA27499@thought.org> <4cfaf16b./uHAeLS0wfpxq8FB%perryh@pluto.rain.com> <20101205043257.GA3854@thought.org> <20101205084403.59ad70e7@gumby.homeunix.com> <20101205181945.GC39513@libertas.local.camdensoftware.com> Content-Type: text/plain; charset="ASCII" Date: Mon, 06 Dec 2010 11:29:36 +1030 Message-ID: <1291597176.2045.18.camel@predator-ii.buffyverse> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: regex question.... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2010 01:15:28 -0000 On Sun, 2010-12-05 at 10:19 -0800, Chip Camden wrote: > Quoth RW on Sunday, 05 December 2010: > > On Sat, 4 Dec 2010 20:32:57 -0800 > > Gary Kline wrote: > > > > > On Sat, Dec 04, 2010 at 06:49:45PM -0800, xSAPPYx wrote: > > > > > > Also, the + operator means '1 or more' but needs escaped: > > > > %s/[0-9]\+/foo/g > > > > > > > > > Okay. I thought that the + must be perl-only regex... . > > > > It's from "Extended" REs rather than perl specifically, it works > > with sed -E but not plain sed. Not sure about vi. > For me in works in vim but not in vi. In vi it requires setting the "extended" option which is unset by default - "set all" will display "noextended". In POSIX "extended" REs '+' is a metacharacter so the expression for "sed -E" and vi with "extended" enabled is simply "[0-9]+" (likewise for "grep -E" etc). It seems to be a "gnuism" that an escaped "+" works in "basic" REs, so it works in grep, gnu sed (gsed) etc. -- Wayne