Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Count Email Address

DZone's Guide to

Count Email Address

·
Free Resource
// description of your code here


/*
  flex count.l; cc lex.yy.c -lfl -o count
*/
%{
int num_lines = 0, num_addr = 0;
%}

%%
\n    ++num_lines;
[a-z0-9]+([_\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\.[a-z]{2,} {
   ++num_addr;
}
.     ;
%%

main() {
   yylex();
   printf( "# of lines = %d, # of addresses = %d\n",
   num_lines, num_addr);
   return 0;
}

/* EOF */

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}