There are a lot of question on stack overflow possibly for regular expression for email. I assume I will not get taged as duplicate question…:)
Currently I am using regular expression for email address:
\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
This works fine with following:
xyz@gmail.com
What I want to allowed here user can give space at begining or at ending and possibly both for instance: ” nihantanu@gmail.com ” I want to pass it by regular expression Currently it’s giving Invalid I believe it should be.
What I tried ^[ \t]+|[ \t]+$ + \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
But It’s not working I am not more familiar with how to write regular expression. Currently I m trying to learn from Here http://www.regular-expressions.info/examples.html.
Try
\s*\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*.