package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\* S12 \(Amount: 730\.00 USD, Special Quantity: (?<S12Quantity>\d*)\)
\* IRONWORKS DRing \(Amount: 1,599\.00 USD, Special Quantity: (?<DQuantity>\d*)\)
\* IRONWORKS LRing \(Amount: 399\.00 USD, Special Quantity: (?<LQuantity>\d*)\)
\* IRONWORKS SRing \(Amount: 1,199\.00 USD, Special Quantity: (?<SQuantity>\d*)`)
var str = `* S12 (Amount: 730.00 USD, Special Quantity: 1546)
* IRONWORKS DRing (Amount: 1,599.00 USD, Special Quantity: 1)
* IRONWORKS LRing (Amount: 399.00 USD, Special Quantity: 1)
* IRONWORKS SRing (Amount: 1,199.00 USD, Special Quantity: 1) **`
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/