Wik*_*żew 8
{}{city}{state}{zip}
FindAllString
r := regexp.MustCompile(`{[^}]*}`)
matches := r.FindAllString("{city}, {state} {zip}", -1)
请参阅Go演示。
FindAllStringSubmatch{([^}]*)}
r := regexp.MustCompile(`{([^}]*)}`)
matches := r.FindAllStringSubmatch("{city}, {state} {zip}", -1)
for _, v := range matches {
fmt.Println(v[1])
}
请参阅此Go演示。