Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Is RegEx in Perl not NFA anymore?

by dasgar (Priest)
on Oct 19, 2016 at 18:41 UTC ( [id://1174311]=note: print w/replies, xml ) Need Help??


in reply to Is RegEx in Perl not NFA anymore?

That PDF link in your post looks like it could be for the full (or partial) copy of a published book. I'm not a lawyer, but I believe that posting that kind of link may not be compliant with copyright laws.

Look at Chapter 4 that describes NFA and DFA engines. A short way into that chapter, there is a section called "Match Basics" that covers what is common with both engines. In particular, look at the first rule about earliest match wins. It describes that the regex engine looks at the beginning of the string to apply the regex there. If it doesn't match, it moves to the next character and tries the regex again. Both NFA and DFA will do this.

If you install Regexp::Debugger, you can try your sample text and regex to walk through what the regex engine is doing. You'll see that it is applying that first match wins rule to your string.

I could be wrong, but I believe that your sample text and regex really isn't a good example to use to determine if a regex engine is NFA or DFA.

Replies are listed 'Best First'.
Re^2: Is RegEx in Perl not NFA anymore?
by redbull2012 (Sexton) on Oct 20, 2016 at 02:32 UTC

    Thanks a lot for your reminder. I have updated it into a google search

      I have updated it into a google search

      For the PDF of the book. Why not just link to ISBN 9780596528126 or the O'reilly page?

      Principle of Least Astonishment: Any language that doesn’t occasionally surprise the novice will pay for it by continually surprising the expert

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1174311]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-25 18:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found