11 lines
233 B
Text
11 lines
233 B
Text
use regex::Regex;
|
|
|
|
fn main() {
|
|
let s = "I am a string";
|
|
|
|
if Regex::new("string$").unwrap().is_match(s) {
|
|
println!("Ends with string.");
|
|
}
|
|
|
|
println!("{}", Regex::new(" a ").unwrap().replace(s, " another "));
|
|
}
|