(/d+)(,/d+)*

 

说明:

用于匹配多个数字之间用逗号分隔,且第一个和最后一个字符必须是数字。

 

例如:

,123                 123,                  123,123                  123,123,                 k,123

 

匹配成功的为:

123,123

 

using System;
using System.Text;
using System.Text.RegularExpressions;
public class Test
{
	public static void Main()
	{
		string str;
		str="aa,aa";
		 
	    if(Regex.Match(str, "(\\d+)(,\\d+)*").Value!= goodsIds)
        {
            Console.WriteLine("数据不合法");
        }
	}
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
猜你喜欢
  • 2021-11-24
  • 2021-04-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-28
  • 2021-09-23
相关资源
相似解决方案