// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)\/\/(\S+)业务员分配量\s.*(?<=\s)(\w+)(?=S)").unwrap();
let string = "
//绑定业务员准确率
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;
";
let substitution = "//$1业务员分配率\\n\\tprivate BigDecimal $2SchedulerAccuracy;\\n\\t$0";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", 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 Rust, please visit: https://docs.rs/regex/latest/regex/