package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?:musicdb|videodb|special):\/\/(?<Type>albums|tvshows|genres|masterprofile|artists)\/(?:titles\/)?(?<Identifier>[\w\d\-.]+)\/?(?<Season>\d+)?`)
var str = `musicdb://albums/2/
videodb://tvshows/titles/1/
videodb://tvshows/titles/1/5/?tvshowid=1
musicdb://genres/2/
special://masterprofile/PartyMode-Video.xsp
musicdb://artists/2/?albumartistonly=false`
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/