Friday, April 12, 2019

lex program to check whether Date entered by user in format (dd/mm/yyyy) is valid or not

%{
#include<stdio.h>
%}

%%
((0[1-9])|([1-2][0-9])|(3[0-1]))\/((0[1-9])|(1[0-2]))\/(19[0-9]{2}|2[0-9]{3}) printf("Valid");
.* printf("Invalid");
%%

int main()
{
 yylex();
 return 0;
}

ScreenShot:

No comments:

Post a Comment