Q:

Regex clean up list of unformatted emails addressess

Hi Recently had a list of email addresses in a poorly formatted csv file with things like:
email@address.com; another@address.com.au; onemore@email.com; Email-Name; andagain@email.com; Another Name; First Name(firstnames@email.com);
How would I remove the illegitimate emails? I think if I could match each line that didnt contain an @symbol would have been pretty helpful

A:

The following regex should match all lines that don't contain an @ symbol:
^[^@]*$

The first ^ matches the beginning of a line, the brackets indicate a character class. The second caret means "this class matches any character except the following..." The @ is the character we wish to disallow. The * means "any number of characters that match the character class" and the $ matches the end of the line.
Sorry if this is overly pedantic. :)
You should note that actually matching valid emails is considerably more complex and somewhat open to interpretation: http://www.regular-expressions.info/email.html

