UKUUG home

UKUUG

(the UK's Unix & Open Systems User Group)

Home

Events

About UKUUG

UKUUG Diary

Membership

Book Discounts

Other Discounts

Mailing lists

Sponsors

Newsletter

Consulting

 


 

Mastering Regular Expressions

Jeffrey E F Friedl
Published by O'Reilly Media
ISBN:0-596-52812-4
542 pages
£ 31.99
Published: 18th August 2006
reviewed by John Collins
   in the December 2006 issue (pdf), (html)
bookcover  

Regular expressions are a well-established part of the currency of the computer world, especially the UNIX and Linux sub-worlds. From their humble beginnings in grep and ed, then sed, awk and lex, they really expanded in facilities with Perl and software which adopted the Perl style, such as Python, Java and even .NET.

I sometimes get the impression that programmers have used the regular expression (which I abbreviate to ``RE'' but the author of this book to ``regex'') as a test of their virility and have written their own parser with slightly different features (I plead guilty to doing this myself at one time). Most UNIX systems have ``regex'' and ``regexp'' libraries which have different syntax and features (that's my excuse for writing my own version!). There are two basic styles ``grep'' and ``ed'' style, in which ()s stand for themselves and have to be escaped for grouping and the ``egrep'' and ``perl'' style which is the other way around, but you often have to remember whether the version you are dealing with support things like \b (word boundary) or [:alpha:].

This book introduces regular expressions and takes the reader through all the obscure extensions introduced by Perl such as non-greedy matching (which I find quite useful as (.*?): looks a lot neater to me than ([^:]*): and similar), atomic and possessive matching, look-ahead and look-behind expressions etc.

The author is clearly a serious Perl programmer and most of the examples are taken from Perl. Some of the material, for example interpolating Perl variables and executing expressions, are entirely Perl dependent. Other languages, such as Python, get mentions in passing, in the style ``this is how you do the Perl thing we've just described in the following list of languages''. Java does rather better, as does VB.NET and PHP but I get the feeling that the author's first love is Perl.

I think the book describes the world of Regular Expressions well as far as it goes. Python and other language enthusiasts will miss proper sections on their languages. Major omissions to me are descriptions and use of the various C libraries, in particular the PCRE (Perl Compatible Regular Expression) library which is worth using for all new software. I'd also like a nice appendix or two or a pull-out card listing the syntax of some of the more obscure constructs and what is available in what version of regular expressions.

I think this book will probably be of most use to Perl programmers trying to dream up constructs to achieve particular tasks but it may well disappoint other people.

Back to reviews list

Tel: 01763 273 475
Fax: 01763 273 255
Web: Webmaster
Queries: Ask Here
Join UKUUG Today!

UKUUG Secretariat
PO BOX 37
Buntingford
Herts
SG9 9UQ
More information

Page last modified 02 Apr 2007
Copyright © 1995-2011 UKUUG Ltd.