|(f)lex string with double quotes firstname.lastname@example.org (Joop) (2003-09-23)|
|Re: (f)lex string with double quotes email@example.com (J.H.Jongejan) (2003-09-27)|
|Date:||27 Sep 2003 14:00:00 -0400|
|Posted-Date:||27 Sep 2003 14:00:00 EDT|
> Hi all,
> could anyone help me to a lex regular expression that will pick-up a
> string of the format:
> "Any text and a double quote like this "" and this too"
> This is what some silly language uses and I need to read it with my
> (f)lex program. I just don't know how to go about it.
> [There's a bunch of ways to do it. The simplest is something like this:
> but since strings can be long, I'd rather use start states to go into
> a string scanning state and then back out. -John]
I use this one as an example in manipulating regular expressions.
If 'q' stands for a quote and 'a' for anything not equal to a quote,
a '|' stands for choice and '*' for a repetition of zero or more,
then a regular expression for strings looks like:
This looks like a problem when a 'q' is the next input.
However, this is equivalent to:
which is much easier to convert into an accepting automaton (program).
Univ. of Groningen,
Return to the
Search the comp.compilers archives again.