$re = '/^(?<atributo>(?<pai>(?:[^=.\n]+)\.?){1,6})=(?<valor>(?:[^=\n]+))$/sm';
$str = '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';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php