如何使用正则表达式删除ASP.NETAjax工具包中的选项卡属性
我试图删除由AJAX控件工具包生成的以下标记。 这个场景是我们的GUI团队使用AJAX控件工具包制作GUI,但我需要使用MultiView将它们移动到普通的ASP.NET视图标记 我想删除所有的_designer:属性 这是密码如何使用正则表达式删除ASP.NETAjax工具包中的选项卡属性,asp.net,regex,visual-studio-2008,asp.net-ajax,tabcontrol,Asp.net,Regex,Visual Studio 2008,Asp.net Ajax,Tabcontrol,我试图删除由AJAX控件工具包生成的以下标记。 这个场景是我们的GUI团队使用AJAX控件工具包制作GUI,但我需要使用MultiView将它们移动到普通的ASP.NET视图标记 我想删除所有的_designer:属性 这是密码 <asp:TextBox ID="a" runat="server" __designer:wfdid="w540" /> <asp:DropdownList ID="a" runat="server" __designer:wfdid="w541"
<asp:TextBox ID="a" runat="server" __designer:wfdid="w540" />
<asp:DropdownList ID="a" runat="server" __designer:wfdid="w541" />
.....
<asp:DropdownList ID="a" runat="server" __designer:wfdid="w786" />
替换为空白
有正则表达式专家可以帮忙吗?/*
/*
* Created by SharpDevelop.
* User: box
* Date: 2009-9-13
* Time: 8:13
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text.RegularExpressions;
namespace t1
{
class Sample
{
public static void Main()
{
// Create a regular expression that matches a series of one
// or more white spaces.
string pattern = @"__designer:wfdid=""w\d+""";
Regex rgx = new Regex(pattern);
// Declare a string consisting of text and white spaces.
string aspCode = @"<asp:TextBox ID=""a"" runat=""server"" __designer:wfdid=""w540"" />";
// Replace runs of white space in the input string with a
// comma and a blank.
string outputStr = rgx.Replace(aspCode, ", ");
// Display the resulting string.
Console.WriteLine("Pattern: \"{0}\"", pattern);
Console.WriteLine("Input string: \"{0}\"", aspCode);
Console.WriteLine("Output string: \"{0}\"", outputStr);
}
}
}
*由SharpDevelop创建。
*用户:box
*日期:2009-9-13
*时间:8:13
*
*要更改此模板,请使用工具|选项|编码|编辑标准标题。
*/
使用制度;
使用System.Text.RegularExpressions;
命名空间t1
{
类样本
{
公共静态void Main()
{
//创建与一系列正则表达式匹配的正则表达式
//或更多的空白。
字符串模式=@“\uu设计器:wfdid=”“w\d+”;
正则表达式rgx=新正则表达式(模式);
//声明由文本和空格组成的字符串。
字符串aspCode=@“”;
//将输入字符串中的空白替换为
//逗号和空格。
字符串outputStr=rgx.Replace(aspCode,“,”);
//显示结果字符串。
WriteLine(“模式:\”{0}\”,模式);
WriteLine(“输入字符串:\”{0}\”,aspCode);
WriteLine(“输出字符串:\“{0}\”,outputStr);
}
}
}
/*
*由SharpDevelop创建。
*用户:box
*日期:2009-9-13
*时间:8:13
*
*要更改此模板,请使用工具|选项|编码|编辑标准标题。
*/
使用制度;
使用System.Text.RegularExpressions;
命名空间t1
{
类样本
{
公共静态void Main()
{
//创建与一系列正则表达式匹配的正则表达式
//或更多的空白。
字符串模式=@“\uu设计器:wfdid=”“w\d+”;
正则表达式rgx=新正则表达式(模式);
//声明由文本和空格组成的字符串。
字符串aspCode=@“”;
//将输入字符串中的空白替换为
//逗号和空格。
字符串outputStr=rgx.Replace(aspCode,“,”);
//显示结果字符串。
WriteLine(“模式:\”{0}\”,模式);
WriteLine(“输入字符串:\”{0}\”,aspCode);
WriteLine(“输出字符串:\“{0}\”,outputStr);
}
}
}
如果您想摆脱u designer:mapid=“22”
使用这个正则表达式
如果要摆脱_designer:mapid=“22” 使用这个正则表达式
从“查找选项”使用通配符搜索: __设计者:wfdid=“*”
找到所有这些选项并替换为空。从“查找选项”使用通配符搜索: __设计者:wfdid=“*”
找到所有这些属性并替换为空。不需要该程序,原始海报(OP)正在使用VS find命令删除这些属性@“\uu设计器:wfdid=”“w\d+”即可。一个很好的做法是在属性后删除一个额外的空格,以避免有两个空格,并增加整洁度。我明白了。但我刚刚安装了VisualStudio6.0;p不需要该程序,原始海报(OP)正在使用VS Find命令删除这些属性@“\uu设计器:wfdid=”“w\d+”即可。一个很好的做法是在属性后删除一个额外的空格,以避免有两个空格,并增加整洁度。我明白了。但我刚刚安装了VisualStudio6.0;P
/*
* Created by SharpDevelop.
* User: box
* Date: 2009-9-13
* Time: 8:13
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Text.RegularExpressions;
namespace t1
{
class Sample
{
public static void Main()
{
// Create a regular expression that matches a series of one
// or more white spaces.
string pattern = @"__designer:wfdid=""w\d+""";
Regex rgx = new Regex(pattern);
// Declare a string consisting of text and white spaces.
string aspCode = @"<asp:TextBox ID=""a"" runat=""server"" __designer:wfdid=""w540"" />";
// Replace runs of white space in the input string with a
// comma and a blank.
string outputStr = rgx.Replace(aspCode, ", ");
// Display the resulting string.
Console.WriteLine("Pattern: \"{0}\"", pattern);
Console.WriteLine("Input string: \"{0}\"", aspCode);
Console.WriteLine("Output string: \"{0}\"", outputStr);
}
}
}