package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(node_modules\/(?!is-online)\/(?!public-ip)|bower_components)`)
var str = `./node_modules/
./node_modules//
./node_modules/random-module
./node_modules//random-module
./node_modules/is-online
./node_modules/is-online/foo
./node_modules//public-ip
./node_modules//public-ip/bar
./node_modules/is-online/public-ip
./node_modules/is-online/public-ip/
./bower_components
./bower_components/is-online/`
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/