package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)\$(?P<type>(?:v|a|s))?(?P<prop>(?:lang|lang2|lang3|language|codec|format|ch|channels|res|resolution))(?:(?:_(?P<num>\d+))|(?:_(?P<lang>[^_0-9\$\n]+)(?:_(?P<num2>\d+))?))?\$`)
var str = `$alang$
$alang_0$
$acodec$
$acodec_0$
$acodec_jp$
$acodec_jp_0$
$aformat$
$aformat_0$
$aformat_jp$
$aformat_jp_0$
$ach$
$ach_0$
$ach_jp$
$ach_jp_0$
$achannels$
$achannels_0$
$achannels_jp$
$achannels_jp_0$
$codec$
$res$ $vformat$ $aformat_jp$ $ach_0$`
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/