正则表达式抓捕替换

问题情境 需要将RDL报表里的GetComment( Parameters!F0001.Value , Parameters!F0002.Value ,“total”, Parameters!Language.Value)函数修改为GetCommentForComment( Parameters!F0001.Value , Parameters!F0002.Value ,“total”, Parameters!Language.Value, “ReportConnection0107”)。 思路 使用正则表达式里面的分组进行抓获,再用1将中间固定的参数取出,组成新的字符串。 Vim实现 %s/GetComment(((sw+!w+.w+s,){2}s*“w+“s*,sw+!w+.w+s))/GetCommentForReport(1 , “ReportConnection0107”)/gc 解释:%为全局替换,s为替换。后面则是表达式,和正则表达式...

2011-01-19 · alswl