Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Email Parser Program:

Now days every body of us has email addresses to make contact with each other. The email addresses usually consist of three parts. First is the prefix or user id that is immediately followed by the character ‘@’. Then comes a unique domain name that ends at the occurrence of a dot (.). Finally after the dot, there is a three-character extension such as com, net or edu. A sample email address may be:

myName@yahoo.com

For this assignment, you have to write a program that takes a series of email addresses as a command-line argument and, after parsing/processing the input, display the addresses separately and in alphabetical order at the command window. For example if the email addresses are provided as a long concatenated string like the following:

myname@yahoo.comyour_pet_name@earthmix.orgwonderful3@badar.edu

And then the result shown on the command window should be something like:

myname@yahoo.com
wonderful3@badar.edu
your_pet_name@earthmix.org

In order to qualify as an email address acceptable to us, every entry must be conforming to the following criterion:

• The prefix or the user-id (i.e. the characters before @) should contain at least 6 and maximum of 15 characters.
• The domain name (i.e. the characters after @ and before dot) should contain at least 3 and maximum of 8 characters.
• The extension (i.e. the characters after dot) must contain exactly 3 characters.
• The extension must be one of the following three types: com, org and edu.

Any email address not conforming to the above criteria must be ignored and not displayed in the final output. For example if the input string is:

thenameofmyfriend@yahoo.commy_name@usa.netwonderful1@badar.edu

Then the result shown on the command window should only be:

wonderful1@badar.edu
Posted
Updated 18-Aug-11 2:23am
v2
Comments
Suresh Suthar 18-Aug-11 6:56am    
May I know from where you have cut and pasted this text?
Muzamil Shah 24-Aug-11 14:46pm    
This is an assignment given to me but i'm not getting solve this , Have you any idea about this?

For this assignment, you have to write a program
That means you not anybody else.
 
Share this answer
 
Comments
Muzamil Shah 19-Aug-11 11:13am    
Thanks for suggestion
Use this RexEx [^@.]{6,15}@\w{3,8}\.(com|org|edu)
 
Share this answer
 
v3
Comments
Muzamil Shah 25-Aug-11 16:01pm    
Sir the above regular expression code does't break the the multiple emails given in a single argument line in alphabetic order so what should be done here?
Plz reply:-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900