Friday, April 12, 2019

Lex program for validation of Email-Add. (Consider Email Add. from any domain e.g. @gmail.com)


%{
#include<stdio.h>
%}
%%
^[a-z][a-z0-9_]*(@[A-Za-z]+)(\.[a-z]+)+ {printf("valid");}
.* {printf("invalid");}
%%
main()
{
yylex();
}


ScreenShot:

1 comment: