func compile(expr string) (Regexp, error) { r, _, err := syntax.Compile(expr) if err != nil { return nil, err } return r, nil }
// CompileFreeSpacing parses a regular expression like Compile, // but whitespace characters are ignored and # is parsed as the beggining of a line comment. func CompileFreeSpacing(expr string) (Regexp, error) { r, ext, err := syntax.Compile(ignoreCommentsAndSpaces(expr)) if err != nil { return nil, err } if ext { return r, nil } re, err := regexp.Compile(ignoreComments(ignoreCommentsAndSpaces(expr))) return ®{ Regexp: re, }, err }