Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

internal engine of regular expression

by spadacciniweb (Deacon)
on Dec 14, 2005 at 15:58 UTC ( #516679=perlquestion: print w/replies, xml ) Need Help??
spadacciniweb has asked for the wisdom of the Perl Monks concerning the following question:

I am trying documentation of Regular Expression, but not a traditional guide, I want to be documented to interal engine about reguar expression.
A document would be perfect that it explains the Abstract State Machine of RegExp.

thank you.

Replies are listed 'Best First'.
Re: internal engine of regular expression
by eff_i_g (Curate) on Dec 14, 2005 at 16:13 UTC
Re: internal engine of regular expression
by demerphq (Chancellor) on Dec 14, 2005 at 17:10 UTC

    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.


Re: internal engine of regular expression
by philcrow (Priest) on Dec 14, 2005 at 16:48 UTC
    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.

Re: internal engine of regular expression
by swampyankee (Parson) on Dec 14, 2005 at 16:07 UTC

    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.

Re: internal engine of regular expression
by davido (Cardinal) on Dec 14, 2005 at 18:00 UTC

    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.


Re: internal engine of regular expression
by planetscape (Chancellor) on Dec 15, 2005 at 16:55 UTC
Re: internal engine of regular expression
by spadacciniweb (Deacon) on Jan 23, 2006 at 17:54 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://516679]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2018-09-22 18:40 GMT
Find Nodes?
    Voting Booth?
    Eventually, "covfefe" will come to mean:

    Results (190 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!