You are on page 1of 2

%option main

%%
int u_correct=1;
int sp_found=0;
int count=0;
username
[:][^A-Za-z][\40-\176]*

u_correct=0;

[:][A-Za-z][^A-Za-z0-9._]+

{
if(yyleng==3)
u_correct=1;
else
u_correct=0;
}

[:][A-Za-z][A-Za-z0-9._]*$

{
if(u_correct!=0)
{
if(yyleng<22)
u_correct=1;
}
}
{
u_correct=0;
}

password

{
if(u_correct==1)
printf("correct

username");
else
printf("wrong us
ername");
}
->[\!-\z]*$

{
int d;
int i;
if(yyleng>5 && yyleng<13

)
{
for(i=2;i<yyleng
;i++)
{
d=yytext
[i];
if((d>32
&&d<48)||(d>57&&d<65)||(d>90&&d<97)||(d>122&&d<127))
{
sp_found=1;
break;
}
}
}

if(sp_found==1)
printf("\ncorrec
t password");
else
printf("\nwrong
password");
}
[ \t]

{
if(count==0)
{
printf("\nwrong

password");
count++;
}
}
%%

You might also like