I've this regex for email
^[_a-z0-9-]+(\.[_a-z0-9-]+)*(\+[a-z0-9-]+)?@[a-z0-9-]+(\.[a-z0-9-]+)*$
my test case is johnd@c but it returned true. What's wrong here?
johnd@c
https://codesandbox.io/s/regex-forked-h7r6wk?file=/src/index.js:180-187
This will work:
^[_a-z0-9-]+(\.[_a-z0-9-]+)*(\+[a-z0-9-]+)?@[a-z0-9-]+(\.[a-z0-9-]+)$
Please note that your regex may not perfectly fit all cases nor match all cases in RFC 5322.