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-
| [reply] |
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
| [reply] |
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@))
| [reply] [d/l] |
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." | [reply] |
| [reply] |
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. | [reply] |