求一完整的正则表达式
查找字符串:using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Data;
using System.Xml;
aa.33 + = bb . hhhh.txt;
DataTable dt = new DataTable();
DataColumn dc = new DataColumn("Column1",typeof(string));
dt.Columns.Add(dc);
dc = new DataColumn("Column2",typeof(string));
dt.Columns.Add(dc);
DataRow dr = dt.NewRow();
dr[1] = "a";
dr[2] = "b";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[1] = "c";
dr[2] = "d";
dt.Rows.Add(dr);
udgData.DataSource = dt;
aa=1;
txtOutput.Text = txtProp1.Text + txtProp2.Text + com.bokesoft.himalaya.common.HimalayaContants.REG_HIMALAYA;
需要返回字符串:using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Data;
using System.Xml;
目前使用的表达式 :using+[\s*\w*.*]+;
好象会出问题 希望达人帮我下~
--------------------编程问答-------------------- 你的字符串有问题,我只取了一部分,看看:
string str = "using Infragistics.Win;using Infragistics.Win.UltraWinGrid;using System.Data;using System.Xml;aa.33 + = bb . hhhh.txt;DataTable dt = new DataTable();";
MatchCollection mc = Regex.Matches(str, @"using\s[a-zA-Z.]+;");
foreach (Match m in mc)
{
Console.WriteLine(m.ToString());
}
/*
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Data;
using System.Xml;
请按任意键继续. . .
*/
补充:.NET技术 , C#