正则表达式 - 小技巧展示 源字符串: <td width="60" bgcolor="#FFFFFF">压力</td>我需要一条正则表达式把 "压力" 这个词取出来, 请高手出招 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 (?<=<td width="60" bgcolor="#FFFFFF">)\w+(?=</td>) (?<=<td width="60" bgcolor="#FFFFFF">)\w+(?=</td>) public static string Get_Regex(string Str){ Regex r = new Regex("请告诉我这里应该写什么"); //定义组} string str = File.ReadAllText(Server.MapPath("txttxt.txt"), Encoding.GetEncoding("gb2312")); Regex reg = new Regex(@"(?s)<li>\s*所在地区:((?:(?!</?li).)*)"); foreach (Match m in reg.Matches(str)) Response.Write(m.Groups[1].Value); public static string Get_Regex(string Str){ Regex r = new Regex("(?i)(?<=<td[^>]*?>)[^<>]+(?=</td>)"); //定义组} public static string Get_Regex(string Str){ Regex r = new Regex("<td\s+width="60"\s+bgcolor="#FFFFFF">(?<result>.*?)<\/td>"); //定义组} c# 操作图片 如何使DataGridView的只读属性改变? 为什么用visual studio2010建立数据库时已有服务器名称不显示 c#中的static变量是不是应该按照全局变量来理解 如何控制动态加载的控件? .net 反编译程序下载. c++ c# imported 求ASP.NET案例! 关于正则表达式! 如何根据System.Type进行强类型转换 c# 存储过程,事务的写法 c#怎么获取网页数据
{
Regex r = new Regex("请告诉我这里应该写什么"); //定义组
}
Regex reg = new Regex(@"(?s)<li>\s*所在地区:((?:(?!</?li).)*)");
foreach (Match m in reg.Matches(str))
Response.Write(m.Groups[1].Value);
public static string Get_Regex(string Str)
{
Regex r = new Regex("(?i)(?<=<td[^>]*?>)[^<>]+(?=</td>)"); //定义组
}
public static string Get_Regex(string Str)
{
Regex r = new Regex("<td\s+width="60"\s+bgcolor="#FFFFFF">(?<result>.*?)<\/td>"); //定义组
}