Documentation ¶
Index ¶
- Constants
- type Code
- type CompileError
- type CompileErrorCode
- type MatchError
- type MatchErrorCode
- type Matcher
- func (m *Matcher) Dumper(out io.Writer)
- func (m *Matcher) End() int
- func (m *Matcher) EndForGroup(group int) int
- func (m *Matcher) Find() (bool, error)
- func (m *Matcher) Group(i int) (string, bool)
- func (m *Matcher) GroupCount() int
- func (m *Matcher) HitEnd() bool
- func (m *Matcher) LookingAt() (bool, error)
- func (m *Matcher) MatchAt(startIdx int, toEnd bool) error
- func (m *Matcher) Matches() (bool, error)
- func (m *Matcher) RequireEnd() bool
- func (m *Matcher) Reset(input []rune)
- func (m *Matcher) ResetString(input string)
- func (m *Matcher) Start() int
- func (m *Matcher) StartForGroup(group int) int
- type Pattern
- type RegexpFlag
Constants ¶
View Source
const BreakIteration = false
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompileError ¶
type CompileError struct { Code CompileErrorCode Line int Offset int Context string }
func (*CompileError) Error ¶
func (e *CompileError) Error() string
type CompileErrorCode ¶
type CompileErrorCode int32
const ( InternalError CompileErrorCode = iota + 1 /**< An internal error (bug) was detected. */ RuleSyntax /**< Syntax error in regexp pattern. */ BadEscapeSequence /**< Unrecognized backslash escape sequence in pattern */ PropertySyntax /**< Incorrect Unicode property */ Unimplemented /**< Use of regexp feature that is not yet implemented. */ MismatchedParen /**< Incorrectly nested parentheses in regexp pattern. */ NumberTooBig /**< Decimal number is too large. */ BadInterval /**< Error in {min,max} interval */ MaxLtMin /**< In {min,max}, max is less than min. */ InvalidBackRef /**< Back-reference to a non-existent capture group. */ InvalidFlag /**< Invalid value for match mode flags. */ LookBehindLimit /**< Look-Behind pattern matches must have a bounded maximum length. */ MissingCloseBracket /**< Missing closing bracket on a bracket expression. */ InvalidRange /**< In a character range [x-y], x is greater than y. */ PatternTooBig /**< Pattern exceeds limits on size or complexity. @stable ICU 55 */ InvalidCaptureGroupName /**< Invalid capture group name. @stable ICU 55 */ )
type MatchError ¶
type MatchError struct { Code MatchErrorCode Pattern string Position int Input []rune }
func (*MatchError) Error ¶
func (e *MatchError) Error() string
type MatchErrorCode ¶
type MatchErrorCode int32
const ( StackOverflow MatchErrorCode = iota /**< Regular expression backtrack stack overflow. */ TimeOut /**< Maximum allowed match time exceeded */ InternalMatchError /**< Internal error (bug) was detected. */ )
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
func NewMatcher ¶
func (*Matcher) EndForGroup ¶
func (*Matcher) GroupCount ¶
func (*Matcher) RequireEnd ¶
func (*Matcher) ResetString ¶
func (*Matcher) StartForGroup ¶
type Pattern ¶
type Pattern struct {
// contains filtered or unexported fields
}
func CompileString ¶
func CompileString(in string, flags RegexpFlag) (*Pattern, error)
func NewPattern ¶
func NewPattern(flags RegexpFlag) *Pattern
type RegexpFlag ¶
type RegexpFlag int32
const ( /** Enable case insensitive matching. @stable ICU 2.4 */ CaseInsensitive RegexpFlag = 2 /** Allow white space and comments within patterns @stable ICU 2.4 */ Comments RegexpFlag = 4 /** If set, '.' matches line terminators, otherwise '.' matching stops at line end. * @stable ICU 2.4 */ DotAll RegexpFlag = 32 /** If set, treat the entire pattern as a literal string. * Metacharacters or escape sequences in the input sequence will be given * no special meaning. * * The flag UREGEX_CASE_INSENSITIVE retains its impact * on matching when used in conjunction with this flag. * The other flags become superfluous. * * @stable ICU 4.0 */ Literal RegexpFlag = 16 /** Control behavior of "$" and "^" * If set, recognize line terminators within string, * otherwise, match only at start and end of input string. * @stable ICU 2.4 */ Multiline RegexpFlag = 8 /** Unix-only line endings. * When this mode is enabled, only \\u000a is recognized as a line ending * in the behavior of ., ^, and $. * @stable ICU 4.0 */ UnixLines RegexpFlag = 1 /** Unicode word boundaries. * If set, \b uses the Unicode TR 29 definition of word boundaries. * Warning: Unicode word boundaries are quite different from * traditional regular expression word boundaries. See * http://unicode.org/reports/tr29/#Word_Boundaries * @stable ICU 2.8 */ UWord RegexpFlag = 256 /** Error on Unrecognized backslash escapes. * If set, fail with an error on patterns that contain * backslash-escaped ASCII letters without a known special * meaning. If this flag is not set, these * escaped letters represent themselves. * @stable ICU 4.0 */ ErrorOnUnknownEscapes RegexpFlag = 512 )
Source Files ¶
Click to show internal directories.
Click to hide internal directories.