You are using a HTML input
field of type email
. The defined and documented behavior of this element is to accept but remove any leading or trailing whitespace. If that's not acceptable, don't use this element.
Your attempt at "fixing" the regex are misdirected. Basic regex reading skills should tell you that the apparent original regex only allows alphabetics just before end of string. Your attempts would basically change it from "mostly nearly correct email" to "mostly nearly correct email, followed by any junk at all, as long as it's not whitespace".
Generally speaking, you fix a too-permissive regex by constraining it more (dropping some stuff it would previously accept, perhaps refactoring the regex along the way; for example, to only allow internal dashes in a domain part, you have to split it into first character, optional middle perhaps with dashes, slightly less optional last character without a dash) but certainly not by adding new matching possibilities -- especially not a broad generic character class repeated an arbitrary number of times.
As already noted in comments, there is no way to completely match every valid email address with a regex, but the regular built-in validation in HTML5 is pretty much guaranteed to do a better job than a random regex you found on some PHP forum.