I am experimenting to learn flex and would like to match string literals. Currently my code is as follows:
"\""([^\n\"\\]*(\\[.\n])*)*"\"" {;}
I have been struggling with variations for an hour or so and cannot make it work as it should. I essentially hoped to match a string literal that cannot contain a new string (unless it is escaped) and supports escaped characters.
I'm probably just writing a bad regex or incompatible with flex. Please advise!
c regex flex-lexer lex string-literals
Thomas Jan 11 '10 at 3:45 2010-01-11 03:45
source share