I am new to the flex regular expression and I don't why it keep showing the bad character. I am wondering if the "?!" is exist in flex regular expression. If not, how to replace it with correct one?
Here is my code
%option noyywrap
%{
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
%}
/* ------------------- Rules space -------------------- */
%%
^aa(a|b)*$ {printf("Token1:%s\n" ,yytext);}
a{3}(a|b)*$ {printf("Token2:%s\n" ,yytext);}
a{2}(a|b)*$ {printf("Token3:%s\n" ,yytext);}
^(?:(a|b){2})+$ {printf("Token4:%s\n" ,yytext);}
^b*(ab*ab*)*$ {printf("Token5:%s\n" ,yytext);}
^(?:.{5})*$ {printf("Token6:%s\n" ,yytext);}
\b((?!aaa)\w)+\b {printf("Token7:%s\n" ,yytext);} // line 19 error appear here
.|\n {} // default rule (always include to match all other strings)
%%
/* ----------------- User code space ------------------ */
main()
{
yylex();
return;
}