RegexExtend.cs 921 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Threading.Tasks;
  7. namespace IoTIntegrationPlatform.Common
  8. {
  9. /// <summary>
  10. ///正则验证
  11. /// </summary>
  12. public static class RegexExtend
  13. {
  14. /// <summary>
  15. /// 邮箱验证
  16. /// </summary>
  17. /// <returns></returns>
  18. public static Regex EmailCheckReg()
  19. {
  20. return new Regex("^[A-Za-z0-9\\u4e00-\\u9fa5]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", RegexOptions.CultureInvariant, TimeSpan.FromMilliseconds(1000));
  21. }
  22. /// <summary>
  23. /// 手机号验证
  24. /// </summary>
  25. /// <returns></returns>
  26. public static Regex PhoneCheckReg()
  27. {
  28. return new Regex("^1[3-9]\\d{9}$", RegexOptions.CultureInvariant, TimeSpan.FromMilliseconds(1000));
  29. }
  30. };
  31. }