VSCode 正則表達式查找和替換子匹配數學? - VSCode regex find & replace submatch math?

問題:

%s@{fileID: \(213[0-9]*\)@\='{fileID: '.(submatch(1)-1900)@

I am using this regex search and replace command in vim to subtract a constant from each matching id.我在 vim 中使用這個正則表達式搜索和替換命令來從每個匹配的 id 中減去一個常量。

I can do the regex find in VSCode but how can I reference the submatch for maths & replace?我可以做VSCode正則表達式找到,但我怎麼可以參考submatch的數學和替換? submatch(1) does not work in VSCode? submatch(1)在 VSCode 中不起作用?

Thanks.謝謝。


解決方案:

參考一: https://en.stackoom.com/question/2LFp1
參考二: https://stackoom.com/question/2LFp1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章