gpt4 book ai didi

regex - Visual Studio 2012 - 查找和替换 - 反向引用

转载 作者:行者123 更新时间:2023-12-04 22:47:53 26 4
gpt4 key购买 nike

我有一个 XML 文件,想要替换从秒到毫秒的每个时间值。

例如,替换 time="250" to time="250000" .

我尝试使用以下

Find: time="([0-9]*)"

Replace: time="$1000"


但是,这似乎不起作用 - 它取代了 time="250" to time="$1000" .有什么办法可以解决这个问题吗?

最佳答案

问题是你的替换不是 $1 ,是$1000 . Visual Studio 不知道您不想在反向引用中包含这 3 个 0。

您可以使用 {}围绕您的反向引用来告诉 Visual Studio 到底要使用什么。

Replace: time="${1}000"

必须注意的是,Visual Studio 2010 及更早版本使用了不同的正则表达式语法,因此这仅对 Visual Studio 2012(以及可能的任何更新版本)有效。

关于regex - Visual Studio 2012 - 查找和替换 - 反向引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16547674/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com