Next: Why doesn't flex have non-greedy operators like perl does?, Previous: Is there a way to make flex treat NULL like a regular character?, Up: FAQ
You need to add a rule that matches the otherwise-unmatched text, e.g.,
     %option yylineno
     %%
     [[a bunch of rules here]]
     
     .	printf("bad input character '%s' at line %d\n", yytext, yylineno);
   See %option default for more information.