package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?ms)\W+注册单位:\W+注册编号/执业印章号:(\W|\d)+注册专业:\W+有效期:\d+年\d+月\d+日`)
var str = `一级注册建造师
注册单位:
云南移民产业投融资有限公司
注册编号/执业印章号:
云1532018201900531
注册专业:
建筑工程
有效期:
2026年08月23日`
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/