On Wed, 23 Sep 1998, Brian McNett wrote: > I'd recommend a good book on regular expressions (I think there's one out > by O'Reilly). The camel and llama books don't really say very much on > the subject, or give more that a hint at how important it is. I disagree with this. While the treatment in the Camel book is not book-length (twenty-something pages devoted to the initial introduction), they succinctly summarize the features and operators and options. Then, to flesh out the understanding, you have the bajillion examples in the rest of the book--one of which is very likely to do exactly what you were looking for. For example, on page 27, right after starting to talk about REs, a snippet of code with this construct if ($line =~ /http:/) { print $line; } is given and explained carefully. Cha-ching! Then, it's shortened in the next paragraph to print if /http:/; after explaining about the ubiquitous $_ variable. TMTOWTDI, ya know. Ba-bing! In addition to this, starting with the Camel gives you the exact syntax needed by Perl; for example, knowing how to bind searches to a variable, escaping Perl key values, the pitfalls of m//o, the possibilities of m//x, and variants such as tr//, s//, and so on. Without bothering (too much) about the computational complexity of REs. > if ($text eq "t*") {print "$text\n"} # Where * is a wildcard becomes print "$text\n" if $text =~ /^t/; Maybe the book on REs is useful if you can't grok the explanation in the Camel book, or maybe if you want to obsess on endless flavors of REs, but to learn REs in Perl, I'd start on the Camel. You get the context and balance of when to use a regex from the Perl arsenal of tools. On the other hand, if you are constantly encountering regexen (reggae?) in a flood of Unix tools like perl, grep, awk, sed, sendmail configs, m4 macros, and on and on andonandon, you may want a generic, broad and deep coverage of REs. Then buy the O'Reilly RE book. "The Camel" = Programming Perl, 2nd Ed. by Larry Wall, Tom Christiansen, and Randal L. Schwartz, O'Reilly Books, ISBN 1-56592-149-6 Since this _is_ a MacPerl list, I should also mention the MacPerl: Power and Ease book, which is more natural for Mac users, since it gives examples of Perl in the context of MacOS. And it explains how to generate a Mac-like user experience using the Toolbox from MacPerl. Others have given the ISBN for it, and have had far more intimate contact with it, so I'll kindly shut up. -- MattLangford ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch