If you're depending on the regular expression for validation, you always want to use A
and z
. ^
and $
will only match up until a newline character, which means they could use an email like [email protected]
<script>dangerous_stuff();</script>
and still have it validate, since the regex only sees everything before the
.
My recommendation would just be completely stripping new lines from a username or email beforehand, since there's pretty much no legitimate reason for one. Then you can safely use EITHER A
z
or ^
$
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…