From owner-freebsd-questions@FreeBSD.ORG Fri Jan 24 17:34:48 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DFB01CD8; Fri, 24 Jan 2014 17:34:48 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8BA1C16E6; Fri, 24 Jan 2014 17:34:48 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.7/8.14.7) with ESMTP id s0OHYl9L089233; Fri, 24 Jan 2014 10:34:47 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.7/8.14.7/Submit) with ESMTP id s0OHYlL0089230; Fri, 24 Jan 2014 10:34:47 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Fri, 24 Jan 2014 10:34:47 -0700 (MST) From: Warren Block To: "'Devin Teske'" Subject: RE: awk programming question In-Reply-To: <050a01cf1929$051c0670$0f541350$@FreeBSD.org> Message-ID: References: <20140123185604.4cbd7611@gumby.homeunix.com> <04a201cf1878$8ebce540$ac36afc0$@FreeBSD.org> <04aa01cf187e$cfcf9ef0$6f6edcd0$@FreeBSD.org> <04d201cf1895$20956890$61c039b0$@FreeBSD.org> <050a01cf1929$051c0670$0f541350$@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Fri, 24 Jan 2014 10:34:47 -0700 (MST) Cc: 'RW' , freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jan 2014 17:34:48 -0000 On Fri, 24 Jan 2014, dteske@FreeBSD.org wrote: >>> I'm not entirely sure how I feel about that -- in terms of >>> readability, I'm not sure if the following is more readable: >>> >>> /(a[^z]*z)/ >> >> Wait till you see the other PCRE stuff. There are lots of things >> that really make it much more powerful. perlre(1) covers it all, >> sketchily and not really in order. >> >> I've said elsewhere, and will repeat again: "Mastering Regular >> Expressions" by Jeffrey E. F. Friedl (the owl book) is amazing. My >> first edition (1997) does not have some of the newer Perl stuff, but >> it's now up to a third edition: >> >> http://shop.oreilly.com/product/9780596528126.do > > Does it cover "back references" ? Definitely one of the more powerful > but esoteric regular expressions (e.g., you want to match a string > that starts with a quote and has a matching terminating quote, but not > match a string that has a quote without matching termination). It does cover backreferences, in the sense of egrep: \<[A-Za-z]+) +\1\> That will find a word followed by one or more spaces and the same word again. > If-so, I'm totally buying that book. Buy it. I've never seen another book that treats such a complex subject with such clarity and readability.