1

This JavaScript commands:

var emailPattern = new RegExp("^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+$");
var res = emailPattern.test("email@.com")
console.log(res); // true

Validates to true. I believe my regex specifies, that the text after the '@' sign must contain one character (one of: a-zA-Z0-9_.-) plus another '.' and some other alphabetic characters.

When I run this same regex on http://regexr.com/, my beliefs are met :)

Why is there a difference, please?

Thanks a lot.

enter image description here A depiction of the regex not validatin email@.com

Igor L.
  • 3,159
  • 7
  • 40
  • 61

0 Answers0