110,538
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Text.RegularExpressions;
namespace Example_LocalNumericFormat
{
class Program
{
static void Main(string[] args)
{
string s = "<html> abccccc </html><html> <html> abc?cccc </html> <html> ab(ccc)cc </html> ";
// \d 表示一个数字,+ 表示 1 个或多个连续的 \d
// (?<= ) 左侧以指定字符开头才匹配.
Match m = Regex.Match(s, "(?<=<html>)(.(?!</html>))*");
Console.WriteLine("第一个:{0}\n第二个:{1}\n第三个:{2}", m, m = m.NextMatch(), m.NextMatch());
Console.Read();
}
}
}