awk programming question
Warren Block
wblock at wonkity.com
Fri Jan 24 17:34:48 UTC 2014
On Fri, 24 Jan 2014, dteske at 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.
More information about the freebsd-questions
mailing list