// It simplifies safe initialization of global variables holding compiled regular
// expressions.
func MustCompile(str string) *Regexp {
- regexp, error := Compile(str)
- if error != nil {
- panic(`regexp: Compile(` + quote(str) + `): ` + error.Error())
+ regexp, err := Compile(str)
+ if err != nil {
+ panic(`regexp: Compile(` + quote(str) + `): ` + err.Error())
}
return regexp
}
// It simplifies safe initialization of global variables holding compiled regular
// expressions.
func MustCompilePOSIX(str string) *Regexp {
- regexp, error := CompilePOSIX(str)
- if error != nil {
- panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + error.Error())
+ regexp, err := CompilePOSIX(str)
+ if err != nil {
+ panic(`regexp: CompilePOSIX(` + quote(str) + `): ` + err.Error())
}
return regexp
}