NotePad++或其他编辑器正则批量替换实例

原始内容:

    public ScmClientBuilder withCommType(ConfCommType commType) {
        this.commType = commType;
        return this;
    }

    public ScmClientBuilder withListeners(ScmEventListener... listeners) {
        this.listeners = listeners;
        return this;
    }

目标内容:

    public ScmClientBuilder withCommType(ConfCommType commType) {
        if (nonNull(commType)) {
             this.commType = commType;   
        }
        return this;
    }

    public ScmClientBuilder withListeners(ScmEventListener... listeners) {
        if (nonNull(listeners)) {
             this.listeners = listeners;   
        }
        return this;
    }

查找正则:

this.([0-9a-zA-Z]+) = ([0-9a-zA-Z]+);

替换正则:

if \(nonNull\($1\)\) {\n  this.$1=$1;   \n}

截图:

NotePad++或其他编辑器正则批量替换实例

上一篇:ELK架构选型与filebeat环境搭建


下一篇:Linux环境CentOS6.9安装配置Elasticsearch6.2.2最全详细教程