RT。例如:有一段代码:
EMU0 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
EMU1 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
RSV0 : in bit;
怎样用正则把注释过滤掉,其他的输出。注释就是"--"符号后边的!
解决方案 »
- PowerShell,SCVMM,C#与虚拟机
- 高分求动生静态页面的相关操作流程和思路,,,求思路,,,
- 生成的文件里的这个ScriptResource.axd是啥东西?
- Parser Error Message: 'myLabel"' is not a valid identifier.
- Graphics画图控件问题???
- 求网址正则。。要求匹配http(s) ,匹配.com.net.cn.gov....匹配ip,端口,参数。
- 怎样将特定的数据写入GridView中
- asp.net中的三层式或多层开发是什么意思?怎么实现?
- 导出数据到Excel时,设置格式的问题
- 求解啊 困住两天了
- 发布64位应用程序报错
- C#操作的几个问题。。。
string pattern = @"(?is)(?:--).*?(?:\n)";
string replacement = "\n";
string input = @"EMU0 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
EMU1 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
RSV0 : in bit;";
input = Regex.Replace(input, pattern, replacement);
Console.WriteLine(input);
/*
EMU0 : in bit;
EMU1 : in bit;
RSV0 : in bit;
*/
string test = @"EMU0 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
EMU1 : in bit; -- must be type in for compliance enable
-- non-JTAG type is inout
RSV0 : in bit;";
Regex reg = new Regex(@"--.*");
string result = reg.Replace(test, "");
richTextBox2.Text = result;