Re: help with regular expressions

Carl Cerecke <cdc@maxnet.co.nz>
12 Oct 2004 00:51:35 -0400

          From comp.compilers

Related articles
help with regular expressions johndoe@yahoo.com (keith) (2004-10-09)
Re: help with regular expressions cdc@maxnet.co.nz (Carl Cerecke) (2004-10-12)
Re: help with regular expressions genew@mail.ocis.net (Gene Wirchenko) (2004-10-12)
Re: help with regular expressions jeremy.wright@microfocus.com (Jeremy Wright) (2004-10-12)
Re: help with regular expressions torbenm@diku.dk (2004-10-12)
| List of all articles for this month |
From: Carl Cerecke <cdc@maxnet.co.nz>
Newsgroups: comp.compilers
Date: 12 Oct 2004 00:51:35 -0400
Organization: TelstraClear
References: 04-10-077
Keywords: lex
Posted-Date: 12 Oct 2004 00:51:35 EDT

keith wrote:


> write the regular expression for strings over the alphabet {a,b,c}
> that don't contain the contiguous substring baa. I've come up with
> this:
>
> (a|c|(ba(b|c))|bb|bc)*
>
> ??? Is this correct?


Not quite. "bbaa" is accepted. So is "babaa".


How about:


a* (ba?|ca*)*


You can only get 2 or more a's at the start, or after a "c".


Thanks for the interesting diversion...
Cheers,
Carl.


Post a followup to this message

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