using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.IO; namespace sxLdfang { class Program { static void Main(string[] args) { string html = @"如字符串 111<#d#>222"; string pattern = @"(?<=<#).*?(?=#>)"; MatchCollection mc = Regex.Matches(html, pattern); foreach (Match m in mc) { Console.WriteLine(m.Value); } Console.ReadKey(); } } } 运行结果: d
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
namespace sxLdfang
{
class Program
{
static void Main(string[] args)
{
string html = @"如字符串 111<#d#>222";
string pattern = @"(?<=<#).*?(?=#>)";
MatchCollection mc = Regex.Matches(html, pattern);
foreach (Match m in mc)
{
Console.WriteLine(m.Value);
}
Console.ReadKey();
}
}
}
运行结果:
d