// 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)(?P<project_id>\w+)(-)(?P<jira_id>\d+)").unwrap();
let string = "KEY-6
At least for jira this is the plugin request ticket for the encryption plugin KEY-662
KEY-662
wanted to follow up on KEY-668 were you able to add people to the project you needed?
https://jira.service.desk/servicedesk/customer/portal/1/KEY-668
[mm](https://jira.service.desk/servicedesk/customer/portal/1/KEY-668)
KEY-6";
let substitution = "[${project_id}-${jira_id}](https://jira.service.desk/servicedesk/customer/portal/1/${project_id}-${jira_id})";
// 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/