I am trying to wirte a regular expression for emails in JFlex. So far I tried with this
L=[a-zA-Z_]+
D=[0-9]+
email=[^(.+)@(\S+)$]
%{
public String lexeme;
%}
%%
{L}({L}|{D})* {lexeme=yytext(); return Identi;}
("(-"{D}+")")|{D}+ {lexeme=yytext(); return Number;}
{email} {lexeme=yytext(); return Email;}
. {return ERROR;}
When I test with an email, the lexer is not matching any email. How to match email?