110,535
社区成员
发帖
与我相关
我的任务
分享
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"^(?:\d+|\d+\.\d+)(?:,\d+|,\d+\.\d+)*$");
string s1="2";
string s2="2,3"
string s3="2.3,1";
string s4="2.3,1,2.3,1.1,2.3";
regex.IsMatch(s1)---true
regex.IsMatch(s2)---true
regex.IsMatch(s3)---true
regex.IsMatch(s4)---true