Documentation ¶
Overview ¶
Package pcre is a library that provides pcre2 regular expressions in pure Go, allowing for features such as cross-compiling.
The lib directory contains source code automatically translated from pcre2's C source code for each supported architecture and/or OS. This package wraps the automatically-translated source to provide a safe interface as close to Go's regexp library as possible.
Index ¶
Constants ¶
const ( Anchored = CompileOption(lib.DPCRE2_ANCHORED) AllowEmptyClass = CompileOption(lib.DPCRE2_ALLOW_EMPTY_CLASS) AltBsux = CompileOption(lib.DPCRE2_ALT_BSUX) AltCircumflex = CompileOption(lib.DPCRE2_ALT_CIRCUMFLEX) AltVerbnames = CompileOption(lib.DPCRE2_ALT_VERBNAMES) AutoCallout = CompileOption(lib.DPCRE2_AUTO_CALLOUT) Caseless = CompileOption(lib.DPCRE2_CASELESS) DollarEndOnly = CompileOption(lib.DPCRE2_DOLLAR_ENDONLY) DotAll = CompileOption(lib.DPCRE2_DOTALL) DupNames = CompileOption(lib.DPCRE2_DUPNAMES) EndAnchored = CompileOption(lib.DPCRE2_ENDANCHORED) Extended = CompileOption(lib.DPCRE2_EXTENDED) FirstLine = CompileOption(lib.DPCRE2_FIRSTLINE) Literal = CompileOption(lib.DPCRE2_LITERAL) MatchInvalidUTF = CompileOption(lib.DPCRE2_MATCH_INVALID_UTF) MatchUnsetBackref = CompileOption(lib.DPCRE2_MATCH_UNSET_BACKREF) Multiline = CompileOption(lib.DPCRE2_MULTILINE) NeverBackslashC = CompileOption(lib.DPCRE2_NEVER_BACKSLASH_C) NeverUCP = CompileOption(lib.DPCRE2_NEVER_UCP) NeverUTF = CompileOption(lib.DPCRE2_NEVER_UTF) NoAutoCapture = CompileOption(lib.DPCRE2_NO_AUTO_CAPTURE) NoAutoPossess = CompileOption(lib.DPCRE2_NO_AUTO_POSSESS) NoDotStarAnchor = CompileOption(lib.DPCRE2_NO_DOTSTAR_ANCHOR) NoStartOptimize = CompileOption(lib.DPCRE2_NO_START_OPTIMIZE) NoUTFCheck = CompileOption(lib.DPCRE2_NO_UTF_CHECK) UCP = CompileOption(lib.DPCRE2_UCP) Ungreedy = CompileOption(lib.DPCRE2_UNGREEDY) UseOffsetLimit = CompileOption(lib.DPCRE2_USE_OFFSET_LIMIT) UTF = CompileOption(lib.DPCRE2_UTF) )
Compile option bits
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CompileOption ¶
type CompileOption uint32
type PcreError ¶
type PcreError struct {
// contains filtered or unexported fields
}
PcreError represents errors returned by underlying pcre2 functions.
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp represents a pcre2 regular expression
func Compile ¶
Compile runs CompileOpts with no options.
Close() should be called on the returned expression once it is no longer needed.
func CompileOpts ¶
func CompileOpts(pattern string, options CompileOption) (*Regexp, error)
CompileOpts compiles the provided pattern using the given options.
Close() should be called on the returned expression once it is no longer needed.
func MustCompile ¶
MustCompile compiles the given pattern and panics if there was an error
Close() should be called on the returned expression once it is no longer needed.
func MustCompileOpts ¶
func MustCompileOpts(pattern string, options CompileOption) *Regexp
MustCompileOpts compiles the given pattern with the given options and panics if there was an error.
Close() should be called on the returned expression once it is no longer needed.