我有很多代码,并希望找到并替换它中的一些文本。我想要替换所有匹配,但不包括那些在评论中的匹配。假设我想在代码中查找并替换字符串“text”。例如:正则表达式的注释
Console.WriteLine("text"); // must be replaced
// some text /* does not need to be replaced because this string begins from "//" */
不幸的是,我不知道如何用正则表达式来做到这一点。有人能帮助我吗?
会是什么在第二行输出? – vks 2014-10-22 08:43:04
第二行未找到。正则表达式我想得到不匹配第二行中的“文本” – Itsme 2014-10-22 08:48:06
您正在使用哪个工具? – nhahtdh 2014-10-22 08:55:37