字符串                      要取出的数
UISDA1.DAY2.E_QW,         2
UISDA1.DAY10.E_QW,      10
UISDA1.DAY100.E_QW,    100
UISDA1.UUPPI1.E_QW,     后面的1
UISDA1.ABCD4.E_QW          4

解决方案 »

  1.   

    正则 
     @"(?is)(?<=DAY)[\d]+";
      

  2.   

    写了一个,楼主不懂正则就用土方法吧class Program
    {
        static void Main(string[] args)
        {
            string[] content = 
                {
                    "UISDA1.DAY2.E_QW,",
                    "UISDA1.DAY10.E_QW,",
                    "UISDA1.DAY100.E_QW,",
                    "UISDA1.UUPPI1.E_QW,",
                    "UUISDA1.ABCD4.E_QW"
                };        foreach (string str in content)
            {
                Console.WriteLine(ExtractNumber(str));
            }        Console.ReadLine();
        }    static string ExtractNumber(string txt)
        {
            string result = String.Empty;
            int start = txt.Length - 1;
            int end = start;
            while (start > 0)
            {
                if (txt[start] >= '0' && txt[start] <= '9')
                {
                    end = start;
                    while (start-- > 0)
                    {
                        if ((txt[start] < '0' || txt[start] > '9'))
                            break;
                    }
                    result = txt.Substring(start + 1, end - start);
                    break;
                }
                start--;
            }
            return result;
        }
    }
      

  3.   

    (?<=\w+\.[A-Z]+)\d+
    string str=@"UISDA1.DAY2.E_QW,         
    UISDA1.DAY10.E_QW,    
    UISDA1.DAY100.E_QW,    
    UISDA1.UUPPI1.E_QW,     
    UISDA1.ABCD4.E_QW";
    foreach(Match m in Regex.Matches(str,@"(?<=\w+\.[A-Z]+)\d+"))
    {
      Console.WriteLine(m.Value);
    }
      

  4.   


    string str=@"UISDA1.DAY2.E_QW,         
    UISDA1.DAY10.E_QW,    
    UISDA1.DAY100.E_QW,    
    UISDA1.UUPPI1.E_QW,     
    UISDA1.ABCD4.E_QW";
    foreach(Match m in Regex.Matches(str,@"(?<=\w+\.[A-Z]+)\d+"))
    {
      Console.WriteLine(m.Value);
    }
      

  5.   

    用string.LastIndexOf('.')也可以吧