dogbert has asked for the wisdom of the Perl Monks concerning the following question:

I just started learning perl and I would like to know if anyone could recommend some more books,website, and or texts that I can read about pattern matching. I'm currently in chapter 6 of the perl cook book and I'm still a little fuzzy on pattern matching. -dogbert

Replies are listed 'Best First'.
Re: pattern matching
by gjb (Vicar) on Jan 04, 2003 at 03:26 UTC

    A few tips:

    • You may want to have a look at Mastering Regular Expressions.
    • Komodo, ActiveState's Perl/Python/XSLT/whatnot editor has facilities to play around with regular expressions, it might be nice to learn by experimenting.
    • Along the same line, the YAPE::Regex::Explain module on CPAN "explains" what a given regex does.
    • There are several entries on regexs in the Tutorials section of this site.
    • There's of course also perlre, but that you problably know.
    This should get you started I hope, -gjb-

Re: pattern matching
by tachyon (Chancellor) on Jan 04, 2003 at 09:33 UTC

    Perlmonks own japhy is writing a book for Manning on regexp's which you can read at http://japhy.perlmonk.org/book/

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: pattern matching
by aspen (Sexton) on Jan 04, 2003 at 18:49 UTC
    You might consider purchasing O'Reilly's "Programming Perl", 3rd ed. It's an excellent complement to the Perl Cookbook for learning the language. Chapter 5, Pattern Matching, is both a tutotorial as well as a definition of the RegEx language. It would provide you a good, complete base on which to attack creating and decoding complex pattern matches.

    The book overall is just as good in teaching the rest of the Perl language, environment, "culture", and serving as a technical reference.

    Andy

    @_="the journeyman larry disciple keeps learning\n"=~/(.)/gs, print(map$_[$_-77],unpack(q=c*=,q@QSdM[]uRMNV^[ni_\[N]eki^y@))
Re: pattern matching
by jacques (Priest) on Jan 04, 2003 at 03:24 UTC
Re: pattern matching
by logan (Curate) on Jan 04, 2003 at 22:10 UTC
    While the Perl Cookbook is invaluable, there is no better resource than Saint Larry's Progamming Perl. I would also recommend Mastering Regular Expressions.

    If you have the bucks, it's worth picking up The Perl CD Bookshelf. It contains Perl in a Nutshell, Learning Perl, Programming Perl, The Perl Cookbook, Perl & XML, Perl & LWP, and Mastering Perl/Tk all in cd format, complete with source code listings.

    -Logan
    "What do I want? I'm an American. I want more."

Re: pattern matching
by fredopalus (Friar) on Jan 05, 2003 at 03:25 UTC
Re: pattern matching
by spurperl (Priest) on Jan 05, 2003 at 11:13 UTC
    Just to add to the resources other monks suggested:

    The best way to learn is to learn by example and practice. First, take a good look at Cookbook's Regex Grabbag - it is a terrific resource. Make sure you understand each and every one of the regexes there. Feel free to ask here if you don't.
    Once you master that, just try to solve problems and apply regexes when needed... If you run into problems, feel free to ask.