re = /\/\/(\S+)业务员分配量\s.*(?<=\s)(\w+)(?=S)/m
str = '
//绑定业务员准确率
private int bindSchedulerAccuracy;
//绑定业务员分配率
private BigDecimal bindSchedulerAccuracy;
//绑定业务员分配量
private int bindSchedulerCount;
//绑定业务员重分网点量
private int bindReSchedulerGsCount;
//绑定业务员重分分部量
private int bindReSchedulerSjCount;
//绑定业务员重分业务员量
private int bindReSchedulerYwyCount;
//历史业务员准确率
private int historySchedulerAccuracy;
//历史业务员分配率
private BigDecimal historySchedulerAccuracy;
//历史业务员分配量
private int historySchedulerCount;
//历史业务员重分网点量
private int historyReSchedulerGsCount;
//历史业务员重分分部量
private int historyReSchedulerSjCount;
//历史业务员重分业务员量
private int historyReSchedulerYwyCount;
//电子围栏业务员准确率
private int fenceSchedulerAccuracy;
//电子围栏业务员分配率
private BigDecimal fenceSchedulerAccuracy;
//电子围栏业务员分配量
private int fenceSchedulerCount;
//电子围栏业务员重分网点量
private int fenceReSchedulerGsCount;
//电子围栏业务员重分分部量
private int fenceReSchedulerSjCount;
//电子围栏业务员重分业务员量
private int fenceReSchedulerYwyCount;
//附近业务员准确率
private int nearSchedulerAccuracy;
//附近业务员分配率
private BigDecimal nearSchedulerAccuracy;
//附近业务员分配量
private int nearSchedulerCount;
//附近业务员重分网点量
private int nearReSchedulerGsCount;
//附近业务员重分分部量
private int nearReSchedulerSjCount;
//附近业务员重分业务员量
private int nearReSchedulerYwyCount;
//预测业务员准确率
private int predictSchedulerAccuracy;
//预测业务员分配率
private BigDecimal predictSchedulerAccuracy;
//预测业务员分配量
private int predictSchedulerCount;
//预测业务员重分网点量
private int predictReSchedulerGsCount;
//预测业务员重分分部量
private int predictReSchedulerSjCount;
//预测业务员重分业务员量
private int predictReSchedulerYwyCount;
//顺路业务员准确率
private int onthewaySchedulerAccuracy;
//顺路业务员分配率
private BigDecimal onthewaySchedulerAccuracy;
//顺路业务员分配量
private int onthewaySchedulerCount;
//顺路业务员重分网点量
private int onthewayReSchedulerGsCount;
//顺路业务员重分分部量
private int onthewayReSchedulerSjCount;
//顺路业务员重分业务员量
private int onthewayReSchedulerYwyCount;
//地址业务员准确率
private int addressSchedulerAccuracy;
//地址业务员分配率
private BigDecimal addressSchedulerAccuracy;
//地址业务员分配量
private int addressSchedulerCount;
//地址业务员重分网点量
private int addressReSchedulerGsCount;
//地址业务员重分分部量
private int addressReSchedulerSjCount;
//地址业务员重分业务员量
private int addressReSchedulerYwyCount;
'
subst = '//$1业务员分配率\\n\\tprivate BigDecimal $2SchedulerAccuracy;\\n\\t$0'
result = str.gsub(re, subst)
# Print the result of the substitution
puts result
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html