在SQL中使用导出功能导出了全部的函数,生成了一个文本文件.格式如下:function F_1()
...
function F_2()
...
select * from F_abc
...
function F_3()
...
F_abc
...
function F_4()
...我想找出所有在函数内部中包含了 "F_abc" 的函数名.在这个例子中即为 F_2,F_3
苦思几天不得果,只能上CSDN求各位帮忙了!
...
function F_2()
...
select * from F_abc
...
function F_3()
...
F_abc
...
function F_4()
...我想找出所有在函数内部中包含了 "F_abc" 的函数名.在这个例子中即为 F_2,F_3
苦思几天不得果,只能上CSDN求各位帮忙了!
如果只是这种需求,那试下吧
List<string> funcList = new List<string>();
Regex.Replace(str, @"function\s+(?<name>\S+)\s*\(\)(?<content>[\s\S]*?)(?=function\s+\S+\s*\(\)|$)", delegate(Match m){if (m.Groups["content"].Value.IndexOf("F_abc") > -1) funcList.Add(m.Groups["name"].Value);return "";}, RegexOptions.IgnoreCase);
foreach (string funcName in funcList)
{
richTextBox1.Text += funcName + "\n";
}
Regex.Replace(str, @"function\s+(?<name>\S+)\s*\(\)(?<content>[\s\S]*?)(?=function\s+\S+\s*\(\)|$)", delegate(Match m){if (m.Groups["content"].Value.IndexOf("F_abc") > -1) funcList.Add(m.Groups["name"].Value);return "";}, RegexOptions.IgnoreCase);
foreach (string funcName in funcList)
{
richTextBox1.Text += funcName + "\n";
}
http://unibetter.com/deerchao/zhengzhe-biaodashi-jiaocheng-se.htm#mission