-
-
Save rust-play/d4c319363d377eb2c352740bd0b93013 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let regex = regex::Regex::new(r"^(?P<qualifier>[+?~-])?(?P<is_a>a)(?:[:]|)?(?P<mechamism>.+)?").unwrap(); | |
[ | |
"a", | |
"a:example.com", | |
"~a:example.com", | |
"a:mailers.example.com", | |
"-a:mailers.example.com", | |
"a/24", | |
"-a:offsite.example.com/24]", | |
"mx", | |
"+mx:mailer.com", | |
] | |
.iter() | |
.copied() | |
.map(|string| regex.captures(string)) | |
.for_each(|cap| println!("{:?}", cap)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment