package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)object\/(?:custom|standard)\/(.*?(?=\/type[ab]|$))(?:\/(type[ab])(?:\/(.*))?)?`)
var str = `Objects/Custom Objects/Applicant/Recruitment Pipeline/Buttons, Links, and Actions/Accept
object/custom/name1/name2
object/custom/name1/name2/typea
object/custom/name1/name2/typea/item`
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/