string a = "aaaaa<aaa>aaaaaaaaa<style color='red' font='size:14px;' > d>fcolor<>d<font.f </style><style color='red' font='size:14px;' > d>fcolor<>d<font.f </style>";取出第一个“<style color='red' font='size:14px;' > d>fcolor<>d<font.f </style>”
 请大家帮帮忙。

解决方案 »

  1.   


                string a = "aaaaa<aaa>aaaaaaaaa<style color='red' font='size:14px;' > d>fcolor<>d<font.f </style><style color='red' font='size:14px;' > d>fcolor<>d<font.f </style>";            Regex reg = new Regex(@"<style[^/]*>.*?</style>");            MatchCollection ms = reg.Matches(a);            if (ms.Count > 0)
                    Console.WriteLine(ms[0].Value);