package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?sm)^(?<atributo>(?<pai>(?:[^=.\n]+)\.?){1,6})=(?<valor>(?:[^=\n]+))$`)
var 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`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
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 Golang, please visit: https://golang.org/pkg/regexp/