use regex::Regex;
fn main() {
// Declare the regex pattern
let pattern = Regex::new(r"^htt+p$").unwrap();
// Test strings
let test_strings = ["http", "htttp", "httttp", "httpp", "htp"];
// Check matches
for test in test_strings.iter() {
let matches = pattern.is_match(test);
println!("Matches \"{}\": {}", test, matches);
}
}
// Matches "httpp": True or false, depending on how matches() method works
/*
run:
Matches "http": true
Matches "htttp": true
Matches "httttp": true
Matches "httpp": false
Matches "htp": false
*/