vscode regex子匹配评估而不是串联? [英] vscode regex sub match evaluate instead of concatenate?
本文介绍了vscode regex子匹配评估而不是串联?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Test 300
Test 301
Test 302
我可以使用正则表达式查找这些内容:
I can use regex find to loop through these:
Test (3[0-9]*)
当我尝试用数学替换时,它会串联而不是求值吗?
When I try replace with math it concatenates instead of evaluates?
Test $1-100
因此,它变成:
Test 300-100
是否可以求值而不是连接,所以变为:
Is it possible to evaluate instead of concatenate, so it becomes:
Test 200
谢谢.
推荐答案
You can use the VS Code Super Replace extension to achieve this.
查找字段为正则表达式
替换是替换表达式.使用$$index
语法的子匹配将使用处理功能字段
Replace is the replace expression. Sub match with $$index
syntax will be resolved using the function in Processing function field
以下是一个使用示例,可以回答您的问题:
Here is an example of use that answers your question :
这篇关于vscode regex子匹配评估而不是串联?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文