/////////////
// Compile
/////////////
flex emails.l
g++ lex.yy.c -ll -Wno-deprecated
////////////
// emails.l
////////////
%{
#include <stdio.h>
%}
%%
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]+ {
printf("EMAIL: %s\n", yytext);
}
^"Secret"$ { printf("Special secret match!"); }
. ; /*matches any single character */
\n ; /*matches newline */
%%
int main(void) {
yylex();
return 0;
}