| [reply] |
Heh, as soon as you find some documentation on how Perls regex engine works be sure to send it to the perl5porters mailing list. I believe there is certain level of consensus that the regex engine implementation is one of the most difficult and minimally documented part of Perl.
---
$world=~s/war/peace/g
| [reply] |
If you really want to know how to write an engine you probably need to start with some compiler theory. The traditional text for this is the dragon book ISBN 0201100886 by Aho and others. Other treatments may or may not be more helpful. Try searching for 'compiler design' on your favorite on-line bookseller. These books explain parsing theory and their state machines.
None of the above is useful for writing regexes that work well. For that follow the advice offered earlier (especially the advice to read Friedl's book on regexes).
Phil
Update:Added isbn tag. | [reply] |
Ciao.
The Camel Book (Wall, L, Christiansen, T, and Schwartz, R, Programming Perl, 2/ed, O'Reilly & Associates, Sebastapol, CA: 1996 has some explanation of the regexp engine. For detailed information about the internal workings of the regexp engine you could read the code, or, probably a trifle less painful, ask Mr Schwartz or Mr Wall very nicely. Before doing either, I'd do a super search.
| [reply] |
I have to second that the Owls book, Mastering Regular Expressions, by Jeffery Friedl, published by O'Reilly & Associates is going to be your best bet. It doesn't dive into the actual code of Perl's RE engine, but it does offer a good discussion of DFA and NFA differences and attributes. And there's nowhere (including the POD) where you'll find a more thorough discussion of Perl's regular expression engine. Friedl himself does have a very thorough understanding of the code behind Perl's regular expression engine. However, if you have a specific need, you might try contacting one of the P5P individuals.
| [reply] |
| [reply] |
| [reply] |