package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?i)d=?\s*\d+\.\d+\s*(?:см)?|(?<!h|h=\s)\d+\.\d+\s*(?:см)`)
var str = `Салатник 600 мл h= 4.7 см 19.3см 19.3 см d 19.3 см d=19.3 см D=19.3 600 мл
Салатник 600 мл V= 4.7 л 19.3см 19.3 см d 19.3 см d=19.3 см D=19.3 600 мл
Салатник 600 мл h= 4.7 19.3см 19.3 см d 19.3 см d=19.3 см D=19.3 600 мл
Салатник 600 мл h= 4.7 19.3см 19.3 см d 19.3 см d=19.3 см D=19.3 600 мл
Салатник 19.3см d=19.3 см 600 мл h= 4.7см 19.3 см d 19.3 см D=19.3 600 мл`
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/