Message from discussion
Greppng
Received: by 10.42.211.71 with SMTP id gn7mr12487419icb.11.1351788475412;
Thu, 01 Nov 2012 09:47:55 -0700 (PDT)
X-BeenThere: bbedit@googlegroups.com
Received: by 10.43.70.79 with SMTP id yf15ls1480058icb.6.gmail; Thu, 01 Nov
2012 09:47:53 -0700 (PDT)
Received: by 10.42.33.9 with SMTP id g9mr24404551icd.25.1351788473359;
Thu, 01 Nov 2012 09:47:53 -0700 (PDT)
Received: by 10.42.33.9 with SMTP id g9mr24404550icd.25.1351788473347;
Thu, 01 Nov 2012 09:47:53 -0700 (PDT)
Return-Path: <r...@tamias.net>
Received: from penkwe.pair.com (penkwe.pair.com. [209.68.2.65])
by gmr-mx.google.com with SMTP id hr6si2427203igc.0.2012.11.01.09.47.52;
Thu, 01 Nov 2012 09:47:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of r...@tamias.net designates 209.68.2.65 as permitted sender) client-ip=209.68.2.65;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of r...@tamias.net designates 209.68.2.65 as permitted sender) smtp.mail=...@tamias.net
Received: (qmail 74146 invoked by uid 3309); 1 Nov 2012 16:47:52 -0000
Date: Thu, 1 Nov 2012 12:47:52 -0400
From: Ronald J Kimball <r...@tamias.net>
To: bbedit@googlegroups.com
Subject: Re: Greppng
Message-ID: <20121101164752.GB61782@penkwe.pair.com>
References: <906BAD1E-E8A7-4ECB-8B24-A30311A3DCC0@kreme.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <906BAD1E-E8A7-4ECB-8B24-A30311A3DCC0@kreme.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
On Wed, Oct 31, 2012 at 10:40:21AM -0600, LuKreme wrote:
> I want to grep for words in a file that contain 'a' 'b' and 'c' in any order. I also want to find words that contain two c's, even if not together (so access and chance).
>
> I might even want words with two c's AND a and b, again in any order.
>
> I feel like I am forgetting something basic.
True regular expressions are not well-suited to finding substrings in
arbitrary order. However, you could do this using look-ahead:
(?i)(?=[a-z]*a)(?=[a-z]*b)(?=[a-z]*c[a-z]*c)([a-z]+)
This regular expression works in Perl; I haven't tested it in BBEdit.
Ronald