JS 中文邮箱正则判断

3 min read
/**
 * https://github.com/any86/any-rule
 * @see https://github.com/any86/any-rule/blob/master/packages/www/src/RULES.js
 * @author any86
 */

/**
 * 非负整数
 *
 * @example
 * 1231,123
 */
export const NonNegativeInteger = /^[1-9]\d*|0$/

/**
 * 整数
 */
export const Integer = /^-?[0-9]\d*$/

/**
 * 浮点数
 *
 * @example
 * 1.5
 */
export const RegExpFloatNumber = /^(-?\d+)(\.\d+)?$/
/**
 * email(支持中文邮箱)
 * @example
 * '[email protected]', '[email protected]', '啦啦啦@126.com'
 */
export const RegExpEmail
  = /^[A-Za-z0-9\u4E00-\u9FA5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/