ValidateHelper.cs 506 B

1234567891011121314151617
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Text.RegularExpressions;
  5. public class ValidateHelper
  6. {
  7. public static bool IsEmail(string email)
  8. {
  9. return Regex.IsMatch(email, @"^\w+([-+.\']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", RegexOptions.IgnoreCase);
  10. }
  11. public static bool IsMobilePhone(string phone)
  12. {
  13. return Regex.IsMatch(phone, @"^(((13[0-9]{1})|(15[0-35-9]{1})|(17[0-9]{1})|(18[0-9]{1})|(19[0-9]{1}))+\d{8})$");
  14. }
  15. }