%{ #includes, etc. globals externs %} %options MACROS regex %% regexpressions { C code when that regex matches } a matches itself abc concatenation a* zero or more a|b a or b (a) matches a [abc] character set - any 1 [123a-cdef] character set - any 1 from a range [^123a-cdef] character set - any 1 not in the set ^a match a only when it is at the beginning of a line a$ match a only when it is at the end of a line a+ one or more a? zero or one \* matches * "" matches nothing "*" matches * . matches anything except newline {MACRONAME} replaced by a macro definition (....){4} matches 4 times (....){3,6} matches from 3 to 6 times regexpressions { C code when that regex matches } regexpressions { C code when that regex matches } %%