package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`!(?!(.|\n|\r)*FastEthernet\d\d?\/\d\d?\.\d{1,3})`)
var str = `interface FastEthernet0/0
shutdown
!
interface FastEthernet0/0.100
ip address 192.168.1.100
!
interface FastEthernet0/1
shutdown
!`
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/