Regular expression does not work correctly on repeated submit

Regular season

^([a-z0-9_\.-]+)@([-a-z0-9\.-]+)\.([a-z\.]{2,6})$

I’m filling out a form and intentionally leaving one of the required fields blank, hit submit. As planned, it gives an error that the field Loginis empty. I enter the login and press send again, and then it gives an error that the email is incorrect, I press send again, the error disappears, I press send again, the error for the wrong email reappears (all the fields are filled in correctly). In short, if you submit the form 50 times in a row, then the error will pop up every other time. On the other hand, if the page is simply updated, then there is no error. There are no troubles in the script, a few more fields are checked with a regular routine, but is the shift just on the soap? What could be the reason?


Answer 1

At least place a minus at the beginning of the character class. That’s more correct.