package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?is)^.*?\Kidr.?\s*[\d.,]+|
.*?\Krp.?\s*[\d.,]+|
.*?\Kprice\s*:?\s*[\d.,]+|
.*?\K\s\d+\s?k\s|
.*?\K\d+rb|
.*?\K[0-9.,]+\s*ribu|
.*?\K\b\d+[.,]\d+[.,]?\d+`)
var str = `"ABBY TOP
Colour : POLKA BLACK
Weight : 0,18
Price : 185,000
Material : Kaos Semi-Fleece
Size : Panjang / Length: 55 cm (depan), 72 (belakang)"`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
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/