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

Tangel <march1896@gmail.com>
Wed, 21 Apr 2010 22:46:27 -0700 (PDT)

          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: Tangel <march1896@gmail.com>
Newsgroups: comp.compilers
Date: Wed, 21 Apr 2010 22:46:27 -0700 (PDT)
Organization: Compilers Central
References: 10-04-052 10-04-055
Keywords: lex, DFA
Posted-Date: 22 Apr 2010 09:20:06 EDT

On Apr 22, 6:30 am, Chris F Clark <c...@shell01.TheWorld.com> wrote:
>
> Finally, your idea of treating ^ and $ as \n and appending a \n to
> both ends of the buffer is perfectly fine. It's not the only
> solution, but it does have precedent. Why does it seem unsatisfactory
> to you? If you can figure out what's wrong with your idea, it might
> lead you to one of the alternate solutions. BTW, there is nothing
> wrong with non-character labels (what you called weights and I believe
> others have called guards, triggers, or conditions) on your edges, so
> ^ is a perfectly valid label on an edge, you machine just needs to
> know what to do with it.


Thanks very much, the problem I have is like this.
the regexp is /^a*$/, and I try to test if it accept string "aaaaa",
which becomes "\naaaaa\n" after pre-processing. And the regexp accept
the string.
But when the regexp is /a*/, and the buffer is "aaaaa",
after the pre-precessing, "\naaaaa\n" is not acceptable for /a*/.


And the reason why I try make a incompatible and likely buggy version
is that I think I will help me to understand it more.


Please bear my wild english, I am not good at it really.



Post a followup to this message

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