using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace HuanMeng.DotNetCore.Utility; /// /// 手机号 /// public class PhoneNumberValidator { // 正则表达式用于匹配手机号码。可以根据需要调整以适应不同的国家或地区。 private static readonly Regex phoneNumberRegex = new Regex(@"^(1[3-9]\d{9})$"); public static bool IsPhoneNumber(string input) { if (string.IsNullOrWhiteSpace(input)) { return false; } return phoneNumberRegex.IsMatch(input); } }