88
88
// Error codes returned by failures to parse an expression.
90
ErrInternal = Error("internal error")
91
ErrUnmatchedLpar = Error("unmatched '('")
92
ErrUnmatchedRpar = Error("unmatched ')'")
93
ErrUnmatchedLbkt = Error("unmatched '['")
94
ErrUnmatchedRbkt = Error("unmatched ']'")
95
ErrBadRange = Error("bad range in character class")
96
ErrExtraneousBackslash = Error("extraneous backslash")
97
ErrBadClosure = Error("repeated closure (**, ++, etc.)")
98
ErrBareClosure = Error("closure applies to nothing")
99
ErrBadBackslash = Error("illegal backslash escape")
90
ErrInternal = Error("regexp: internal error")
91
ErrUnmatchedLpar = Error("regexp: unmatched '('")
92
ErrUnmatchedRpar = Error("regexp: unmatched ')'")
93
ErrUnmatchedLbkt = Error("regexp: unmatched '['")
94
ErrUnmatchedRbkt = Error("regexp: unmatched ']'")
95
ErrBadRange = Error("regexp: bad range in character class")
96
ErrExtraneousBackslash = Error("regexp: extraneous backslash")
97
ErrBadClosure = Error("regexp: repeated closure (**, ++, etc.)")
98
ErrBareClosure = Error("regexp: closure applies to nothing")
99
ErrBadBackslash = Error("regexp: illegal backslash escape")
159
159
// Regexp is the representation of a compiled regular expression.
160
160
// The public interface is entirely through methods.
161
// A Regexp is safe for concurrent use by multiple goroutines.
161
162
type Regexp struct {
162
163
expr string // the original expression
163
164
prefix string // initial plain text string