要求一个正则表达式
是数字 大于0小于等于15
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
都可 不能识别的
谢谢回答

解决方案 »

  1.   

    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);
                }
            }
        }
    }