package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<=^Fuse - )[\d.\/m]+A|(?<=\s)\dA`)
var str = `Fuse - 1.25A 250V 5x20mm, Glass, Time Delay, 5/pk
Fuse - 1A 250V 5x20mm, Glass, Time Delay, 5/pk
Fuse - 20A 250V 5x20mm, Glass, Time Delay, 5/pk MDA Style
Fuse - 3/4A 250V 5x20mm, Glass, Time Delay, 5/pk MDA Style
Fuse - 340mA 250V 5x20mm, Glass, Time Delay, 5/pk MDA Style
SCR - 4A 400V T0126`
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/