首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在版本中添加"build.counter“的文件内容替换器

在版本中添加"build.counter“的文件内容替换器
EN

Stack Overflow用户
提问于 2018-11-05 23:02:28
回答 2查看 417关注 0票数 1

我使用“文件内容替换器”将版本字符串中的"build.counter“替换为”build.counter“(13468)。

这是文件"AssemblyInfoVersion.cs“中的内容。

代码语言:javascript
复制
using System.Reflection;

[assembly: AssemblyVersionAttribute("3.0.1923.999")]

以下是“文件内容替换器”的msg

代码语言:javascript
复制
File content replacer] Applying replacement "$113467$3" to lines matched by 
pattern "(^\s*\[\s*assembly\s*:\s*AssemblyVersionAttribute\s*\(\"[0-9\*]+\.[0-9\*]+\.)([0-9\*]+\.)([0-9\*]\"\)s*\])" 
 in the files matched by wildcard: **/AssemblyInfoVersion.cs...
 [14:28:44][File content replacer] Total files changed: 0.
 [14:28:44][File content replacer] No modifications were made: either no 
 text matching the pattern was found or the replaced text is the same as the 
 original

我希望把“1923年”改为"13468“。什么都没有。怎么啦?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-11-05 23:13:22

试试(^\s*\[\s*assembly\s*:\s*AssemblyVersionAttribute\s*\(\"[0-9\*]+\.[0-9\*]+\.)([0-9\*]+\.)([0-9\*]+\"\)s*\])

正则表达式模式中缺少最后一个+

票数 2
EN

Stack Overflow用户

发布于 2018-11-05 23:13:09

原因是没有匹配,因为一个错误。检查这个正则表达式:

代码语言:javascript
复制
(^\s*\[\s*assembly\s*:\s*AssemblyVersionAttribute\s*\(\"[0-9\*]+\.[0-9\*]+\.)([0-9\*]+\.)([0-9\*]*\"\)s*\])

我只在上一次**之后添加了一颗星‘[0-9\*]’。然后就匹配了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53163547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档