|
|
| go ahead... be a heretic | |
| PerlMonks |
RE: Answer: What can regular expressions NOT do?by maverick (Curate) |
| on Jun 27, 2000 at 15:40 UTC ( [id://20018]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Let me see if I can make this make sense with digging out a text book...
Regular expressions are implemented internally by a 'finite state automata'. If you've never heard the term, I'll attempt to explain it... Picture a group of circles interconnected by various lines. The circles represent the current state, and the lines represent the next state to go to if a give input is seen. One circle is the start state, and some other number of circles are 'end' states (you can have more than one).
For a specific example try this:
Starting at 'start', take each character of input and follow the link with that
label to the next state. At each step the only thing the automata is concerned with is what state it is in, and what is the next character of input. The is no retained knowledge of what the previous characters were. Since finite state automatas have no 'memory' of what input they've seen before, they have no way of knowing if the correct number of ')' has been found.
Hopefully that made sense, but was probably FMTYWTK
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||