From owner-freebsd-current@FreeBSD.ORG Sun Nov 14 23:48:31 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A883D16A4CE; Sun, 14 Nov 2004 23:48:31 +0000 (GMT) Received: from bache.ece.cmu.edu (BACHE.ECE.CMU.EDU [128.2.129.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EAAB43D48; Sun, 14 Nov 2004 23:48:31 +0000 (GMT) (envelope-from allbery@ece.cmu.edu) Received: from [10.9.204.1] (dsl093-061-215.pit1.dsl.speakeasy.net [66.93.61.215]) by bache.ece.cmu.edu (Postfix) with ESMTP id BA8E582; Sun, 14 Nov 2004 18:48:28 -0500 (EST) From: "Brandon S. Allbery KF8NH" To: Zoltan Frombach In-Reply-To: References: Content-Type: text/plain Message-Id: <1100476106.10768.4.camel@rushlight.kf8nh.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sun, 14 Nov 2004 18:48:27 -0500 Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org cc: freebsd-stable@freebsd.org Subject: Re: Either I do something wrong or there is a regexp bug in sed !! X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Nov 2004 23:48:31 -0000 On Sun, 2004-11-14 at 18:39, Zoltan Frombach wrote: > match anything! After spending like an hour investigating this, I realized > that the + after my bracket expression ( I'm talking about this part here: Normal. > According to the sed man page, the regexp syntax that is used by sed is > documented in the re_format man page. And according to the re_format man > page: "A piece is an atom possibly followed by a single= `*', `+', `?', or You need to read it more carefully. There are two kinds of regular expressions, "basic" and "extended". sed, ed, and grep speak BRE syntax, whereas awk and egrep speak ERE syntax. + is special only in ERE syntax. (And then there's GNU, where the difference between BRE and ERE is that some things use a preceding backslash in BRE and don't in ERE, and vice versa, so GNU sed does what you want if you use \+ instead of +.) -- brandon s. allbery [linux,solaris,freebsd,perl] allbery@kf8nh.com system administrator [WAY too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon univ. KF8NH