110,536
社区成员
发帖
与我相关
我的任务
分享
^([1-9]|1[0-5])$
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace ConsoleApplication11
{
class Program
{
static void Main(string[] args)
{
string str = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ,16";
Regex re = new Regex(@"(?<!\d)([1-9](?!\d))|(1[1-5](?!\d))");
MatchCollection mc = re.Matches(str);
foreach (Match m in mc)
{
Console.WriteLine(m.Value);
}
}
}
}
^([1-9]|1[1-5])$