// 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"(?sm)^(?<atributo>(?<pai>(?:[^=.\n]+)\.?){1,6})=(?<valor>(?:[^=\n]+))$").unwrap();
let string = "php.environment.ini.session-name = sisicmbio
php.environment.ini.session-cookie_domain = icmbio.gov.br
php.environment.ini.session-auto_start = false
php.environment.ini.session-cookie_path = /
php.environment.ini.session-cookie_lifetime = 10800
php.environment.ini.session-cookie_httponly = true
php.environment.ini.session-use_only_cookie = true
php.environment.ini.session-gc_maxlifetime = 10800
php.environment.ini.session-cache_expire = 180
;; [php server mail]
php.mail.sender = smtp
php.mail.from = notifica@domain.gov.br ; conta default usada para enviar mensagens
php.mail.replyTo = reposta@domain.gov.br ; conta usada para reply
php.mail.wordWrap = 60
php.mail.priority = 3 ; 1: high, 3: normal, 5: low
php.mail.encoding = 8bit ; 8bit, 7bit, binary, base64, quoted-printable
php.mail.charset = utf-8
php.mail.contentType = text/html";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
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/