package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)^(.{20})[^.]{4,}(.*)$`)
var str = `1.1234567890.ab
2.123456789012345678901.ab
3.1234567890123456789012.ab
4.12345678901234567890123.ab
5.123456789012345678901234.ab
6.1234567890123456789012345.ab
7.12345678901234567890123456.ab
8.123456789012345678901234567890.ab
9.123456789012345678901234567890.1234567890123456.7890.ab
0.123456789012345678901234567890.12345678901.234567890....abcdef012345
12345678901234567890123456789012345678901234567890`
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/