package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^Maximum amplitude:\s*(-?\d\.\d+)\n`)
var str = `Samples read: 6615000
Length (seconds): 75.000000
Scaled by: 2147483647.0
Maximum amplitude: 0.712219
Minimum amplitude: -0.805969
Midline amplitude: -0.046875
Mean norm: 0.009264
Mean amplitude: -0.000027
RMS amplitude: 0.043011
Maximum delta: 0.734100
Minimum delta: 0.000000
Mean delta: 0.008353
RMS delta: 0.041470
Rough frequency: 6767
Volume adjustment: 1.241`
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/