Sunday, 16 June 2019

Write a LEX program to check for valid E-mail id.

Code:

%{
#include<stdio.h>
int flag=0;
%}
%%
[a-z . 0-9]+@[a-z]+".com"|".in" {flag=1;}
%%
int main()
{
yyin = fopen("input.txt","r");
yylex();
if(flag==1)
printf("Valid Email Id\n");
else
printf("Not Valid Email Id\n");
}
int yywrap()
{
return 1;
}

No comments:

Post a Comment

It's time To increase blogging capability. To have a chance to contribute in digital world. Any Interested People who want to make t...