package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?-s)(200 см</name>\R.*?/)xx/`)
var str = `Пример:
<name>Матрас Dimax ОК Симпл Круглый диаметр 200 см</name>
<url>https://site.ru/matras-dimax-ok-simpl/xx/</url>
Нужно:
<name>Матрас Dimax ОК Симпл Круглый диаметр 200 см</name>
<url>https://site.ru/matras-dimax-ok-simpl/D-200/</url>`
var substitution = "$1D-200/"
fmt.Println(re.ReplaceAllString(str, substitution))
}
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/