Re: Flex regular expression problem

Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
24 Aug 2005 18:17:32 -0400

          From comp.compilers

Related articles
Flex regular expression problem pocm@sat.inesc-id.pt (pmatos) (2005-08-21)
Re: Flex regular expression problem Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2005-08-24)
Re: Flex regular expression problem lfinsto1@gwdg.de (Laurence Finston) (2005-08-24)
Re: Flex regular expression problem bonzini@gnu.org (Paolo Bonzini) (2005-08-31)
| List of all articles for this month |
From: Detlef Meyer-Eltz <Meyer-Eltz@t-online.de>
Newsgroups: comp.compilers
Date: 24 Aug 2005 18:17:32 -0400
Organization: Compilers Central
References: 05-08-079
Keywords: lex
Posted-Date: 24 Aug 2005 18:17:32 EDT

As John already wrote, you can define a string as : "[^"]*"
A string limited to a single line would be : "[^"\r\n]*"
A string limited to a single line, which may contain other double
quotes preceded by a backslash, is:


"([^"\\\r\n]*(\\.[^"\\\r\n]*)*)".


Here the first sub-expression delivers the text inside of the double
qotes. This expression is optimized according to Friedl's scheme (see
the help file of the TextTransformer).


It is funny for me that you ask the question just today. Yesterday I
finished a dialog, by which character classes can be defined by
adding, substracting or negation of predefined character classes,
individual characters or ranges and lists of them. By this dialog the
result of a subtraction of '"' from [:print:] yields in:


-[:word:] !#\$%&'\(\)\*\+,\./:;<=>\?@\[\\\]\^`\{\|\}~


or
-
!#\$%&'\(\)\*\+,\./0123456789:;<=>\?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\[\\\]\^_`abcdefghijklmnopqrstuvwxyz\{\|\}~


(The hyphen is at the begininig, so it doesn't define a range)
The dialog will be included in the next update of the TextTransformer.
If you like, I can send you a little (Windows) test application right
now.


--


Detlef Meyer-Eltz
--
mailto:Meyer-Eltz@t-online.de


url: http://www.texttransformer.de
url: http://www.texttransformer.com


> Hi all,


> I'm having some problems generating the regular expression for "any
> printable character except " between ". For example:
> "hello, how are you"
> "212 dasd 2"
> "bugasd "


> "" - SHOULD NOT WORK
> " " - Can work!


Post a followup to this message

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