package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?|(date .+)|title .+|whatever.+)`)
var str = `+++
date = 2020-09-08T16:18:51+02:00
title = "Lire le cycle de l'Assassin Royal, c'est compliqué"
tags = ["livre"]
copy = "https://twitter.com/jpcaruana/status/1303356472705921026"
really_any_key_I_want = "any value"
+++`
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/