Reputation:
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!
Upvotes: 0
Views: 442
Reputation: 3852
See here to learn about checking email with regexps. It appears it's a quite complex problem :-)
Upvotes: 0
Reputation: 10124
A simple regex that should match most email addresses:
[A-z0-9_.%+-]+@[A-z0-9_.%+-]+\.[A-z]{2,4}
Upvotes: 1