IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    正则表达式抓捕替换

    Log4D发表于 2011-01-19 00:00:00
    love 0
    问题情境 需要将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为替换。后面则是表达式,和正则表达式


沪ICP备19023445号-2号
友情链接