我正在尝试编写一个正则表达式,作为替换操作的一部分。
我有很多路径,如下:
<ProjectReference Include="..\Common.Workflow\Common.Workflow.csproj">
<ProjectReference Include="..\Common.Workflow\Common.Workflow.Interfaces\Common.Workflow.Interfaces.csproj">
<ProjectReference Include="..\Common.Workflow\Common.Workflow.Persistence\Common.Workflow.Persistence.csproj">
<ProjectReference Include="..\Common.Workflow\Common.Workflow.Process\Common.Workflow.Process.csproj">除了包含Common.Workflow.csproj的情况外,我需要在所有情况下替换Common.Workflow\。
作为代码清理的一部分,我正在移动这些文件。
发布于 2011-09-26 05:26:26
将Common\.Workflow\\(?!Common\.Workflow\.csproj)替换为您需要的内容。
发布于 2011-09-26 05:33:33
使用负面的前瞻和负面的回顾,就像这样:
(?<!.*Common.Workflow.csproj)Common.Workflow\\(?!.*Common.Workflow.csproj)解释:
(?<!.*Common.Workflow.csproj)表示“match(?!.*Common.Workflow.csproj)之前不能出现Common.Workflow.csproj”意思是"Common.Workflow.csproj不能出现在匹配之后“如果Common.Workflow.csproj出现在输入中的任何位置,此正则表达式将阻止匹配(您没有指定负匹配仅在搜索后出现)
https://stackoverflow.com/questions/7548710
复制相似问题