package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m).*(\d{13}).*|.*`)
var str = `Ceres Juice Apricot 12 x 1lt unit: 6001240102022
Ceres Juice Cranberry& Kiwi Juice 12 x 1lt... unit:
Ceres Juice Guava 12 x 1lt.. unit:6001240222829
Ceres Juice Orange 12x1lt... unit:
Ceres Juice Medley of Fruits 1L x 12 unit: 6001240100660`
var substitution = "$1"
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/