Re: '^' and '$' in Regular expression

Chris F Clark <cfc@shell01.TheWorld.com>
Thu, 22 Apr 2010 12:36:29 -0400

          From comp.compilers

Related articles
'^' and '$' in Regular expression march1896@gmail.com (Tangel) (2010-04-21)
Re: '^' and '$' in Regular expression cfc@shell01.TheWorld.com (Chris F Clark) (2010-04-21)
Re: '^' and '$' in Regular expression march1896@gmail.com (Tangel) (2010-04-21)
Re: '^' and '$' in Regular expression mailings@jmksf.com (mailings@jmksf.com) (2010-04-22)
Re: '^' and '$' in Regular expression armelasselin@hotmail.com (Armel) (2010-04-22)
Re: '^' and '$' in Regular expression cfc@shell01.TheWorld.com (Chris F Clark) (2010-04-22)
Re: '^' and '$' in Regular expression quinn_jackson2004@yahoo.ca (Quinn Tyler Jackson) (2010-04-22)
Re: '^' and '$' in Regular expression cfc@shell01.TheWorld.com (Chris F Clark) (2010-04-22)
| List of all articles for this month |

From: Chris F Clark <cfc@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: Thu, 22 Apr 2010 12:36:29 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: 10-04-052 10-04-055 10-04-057
Keywords: lex, DFA
Posted-Date: 22 Apr 2010 12:53:39 EDT

Note, since you are doing this as a learning project, may I suggest
some questions you ask yourself. These are more likely to getyou to
understand the theory than simply writing an implementation. This
builds on my previous post in response.


Look at your implementation and the relevant theory and think about
making a regular expression processor that find matches inside strings
and not just if the whole buffer matches.


How does appending ".*$" to a regular expression differ from appending
simply "$"? How should the implementation deal with those different
cases? How about the reverse, prepending "^.*" versus "^"? Same
questions.


If you draw the finite state machine as a graph, how do those changes
look? Is the effect different for an NFA versus a DFA?


Are there implicit edges in an NFA (or DFA) that you don't normally
draw? What semantics do they have? How do those undrawn edge affect
your implementation? what does you implementation do if there is no
transition for a specific character? What alternate things could your
implementation do? How would that affect the semantics of the model?



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.