AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
#Power
 View Only

grep with regex for vaild mail addresses

  • 1.  grep with regex for vaild mail addresses

    Posted Wed August 11, 2010 04:58 AM

    Originally posted by: keyboarder2k


    Hi there,

    I'm trying to build a grep command for a script (korn-shell) which looks for valid mail addresses. This is, what I have so far:

    
    grep -e 
    "^[a-zA-Z0-9][a-zA-Z0-9_\-\.]*[a-zA-Z0-9]@[a-zA-Z0-9]*[a-zA-Z0-9_\-\.]*[\.][a-zA-Z]\{2,4\}$"
    


    But there are some thinks, it doesn't find (are valid, but should not be):


    And there are some false negatives (are not valid, but should be):


    Is there anyone who can help me to build a "perfect" regular expression for my grep to find only valid mail addresses?

    Thanks, Janko
    #AIX-Forum