将<label id="lab" onclick="save()" onblur="kk()"></label>替换为<label id="lab" ></label>
将标签的所有已on开头的函数替换为空
求正则表达式!!!!!
将标签的所有已on开头的函数替换为空
求正则表达式!!!!!
解决方案 »
- 找不见tdbg3?如何解决?
- 问个很奇怪的问题,内容在显示页重复显示,VS中正常,在浏览器中重复的
- HttpFileCollection多文件上传的问题
- 为什么只能插入一次数据到数据库
- 网页模版提取数据问题,在线急等,各位帮忙啊
- 高分请教用户控件问题
- login控件登陆成功,注销,再次用任意帐号都无法登陆的问题??
- 想实现这样的一个功能,点击一文本框,在它的下面出现一个日历,在日历里选一个日期,如何实现?
- 我想用一个数据表中的值绑定DropDownList控件,控制这个控件中<ListItem>里面值的显示,应该怎么写。谢谢
- 怎样调整ASP.NET WEB控件的文字位置~?
- “找到的程序集清单定义与程序集引用不匹配”
- ASP.NET怎么批量下载页面啊??
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str = @"<label id=""lab"" onclick=""save()"" onblur=""kk()""> </label>";
Regex reg = new Regex(@"on\w+=""[^""]+""");
MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
str= str.Replace(m.Value, "");
}
Console.WriteLine(str);
}
}
}<label id="lab" > </label>
Press any key to continue . . .
string result = Regex.Replace("text", @"\s+on.+\=""[^""]*""", RegexOptions.None);
\s+on[a-zA-Z]+="[^"]*"
Console.WriteLine(Regex.Replace(str, @"\s+on.+\=""[^""]*""","", RegexOptions.None));
{
string str = @"<label id=""lab"" onclick=""save()"" onblur=""kk()""> </label>";
Console.WriteLine(Regex.Replace(str, @"(?i)on\w+=""[^""]+""", "", RegexOptions.None));
}
string str = @"<label id=""lab"" onclick=""save()"" onblur=""kk()""> </label>";
string result = Regex.Replace(str, @"\s+on[a-zA-Z]+=""[^""]*""", "",RegexOptions.None);
Console.WriteLine(result);