Sublime Text 2 RegEx 用 n+1 替换 n [英] Sublime Text 2 RegEx replace n with n+1
问题描述
使用正则表达式搜索并替换为 Sublime Text 2,如何用 n+1 替换我的模式匹配 (n)?如果没有办法通过搜索和替换来做到这一点,还有另一种简单的方法吗?
Using RegEx search and replace with Sublime Text 2, how can I replace my pattern matches (n) with n+1? And if there is no way to do this with search and replace, is there another easy way to do it?
我的正则表达式模式是 ^(\d{1,4})\n
,我希望能够做到 $1+1
,目前只输出带有文字+1"的匹配项.
My RegEx pattern is ^(\d{1,4})\n
, and I'd like to be able to do $1+1
, which currently just outputs the match with a literal "+1".
推荐答案
Regex 是该功能的错误工具.然而,有一个 Sublime Text 插件只是为了做你想做的事:Sublime Text 插件来增加/减少所有选定的数字"
Regex is the wrong tool for that function. However, there is Sublime Text plugin just to do what you want: "Sublime Text plugin to increment/decrement all selected numbers"
这篇关于Sublime Text 2 RegEx 用 n+1 替换 n的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!