use regex::Regex; fn main() { let re = Regex::new(r"\$\{([^}]+)\}").unwrap(); let caps = re.captures("abc${w:-x${fred}y${bruce}z}def}g").unwrap(); println!("{:?}", caps); }