package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`^\/(dhtml\/)?(home\.php\?id=([0-9]+)|page-.*-([0-9]+)\.html)`)
var str = `/dhtml/home.php?id=10040
/page-bateaux-electriques-kyosho-10040.html
/dhtml/page-bateaux-electriques-kyosho-10040.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/