tags:

views:

123

answers:

2

What I've tried is as below:

mysql> select '[email protected]' REGEXP '[a-zA-Z0-9_]+(?:[\-\+\.][a-zA-Z0-9_]+)*@[a-zA-Z0-9_]+(?:[\-\.\+][a-zA-Z0-9_]+)*\.[a-zA-Z0-9_]+(?:[\-\.\+][a-zA-Z0-9_]+)*';

ERROR 1139 (42000): Got error 'repetition-operator operand invalid' from regexp

And I've no idea what's wrong with it.

Can anyone here give me the right one that can work?

Thanks a lot!

+1  A: 

A simple regex that should match most email addresses:

[A-z0-9_.%+-]+@[A-z0-9_.%+-]+\.[A-z]{2,4}
David in Dakota
A: 

See here to learn about checking email with regexps. It appears it's a quite complex problem :-)

Reef