StringCommon.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WebAPIBase.Utils
  7. {
  8. internal class StringCommon
  9. {
  10. /// <summary>
  11. /// 邮箱正则表达式
  12. /// </summary>
  13. public static readonly string RegEmail = @"^[-_A-Za-z0-9\.]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$";
  14. public static readonly string RegEmailNoEnds = @"[-_A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}";
  15. /// <summary>
  16. /// 固话号正则表达式
  17. /// </summary>
  18. public static readonly string RegTelephone = "^(0[0-9]{2,3}-)?([2-9][0-9]{6,7})+(-[0-9]{1,4})?$";
  19. public static readonly string RegTelephoneNoEnds = "(0[0-9]{2,3}-)?([2-9][0-9]{6,7})+(-[0-9]{1,4})?";
  20. /// <summary>
  21. /// 手机号正则表达式
  22. /// </summary>
  23. public static readonly string RegCellphone = @"^(13[0-9]|15[0-9]|18[0-9]|17[0-9]|147)\d{8}$";
  24. public static readonly string RegCellphoneNoEnds = @"(13[0-9]|15[0-9]|18[0-9]|147)\d{8}";
  25. /// <summary>
  26. /// ip地址表达式
  27. /// </summary>
  28. public static readonly string RegIp = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
  29. }
  30. }