/** * 校验邮箱 * @param str 邮箱 * @returns 校验邮箱 * @see {@link https://yourhhh.github.io/zztoolDocument} API 文档 * @example * // 调用示例 * regEmail('test@example.com'); // true */ export function regEmail(str: string) { const emailRegex = /^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/; return emailRegex.test(str); }