refactor: update email regex

This commit is contained in:
martgil 2025-06-12 11:03:57 +08:00
parent 5afbf72c30
commit dac26fbd0b

View File

@ -88,7 +88,7 @@ class UserIDPacket {
* since they interfere with `comment` parsing.
*/
const isValidEmail = str => /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(str);
const isValidEmail = str => /^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/.test(str);
const firstBracket = userID.indexOf('<');
const lastBracket = userID.lastIndexOf('>');
if (