Documentation ¶
Overview ¶
Package ogenregex provides an interface to the regex engine.
JSON Schema specification prefers to use ECMA 262 regular expressions. However, Go's regex engine is based on RE2, which is a different engine. Also, Go's regex engine does not support lookbehind assertions, to ensure linear time matching.
This package provides unified interface to both engines. Go's regex engine is used by default, but if the regex is not supported, the dlclark/regexp2 would be used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Regexp ¶
type Regexp interface { Match(s []byte) (bool, error) MatchString(s string) (bool, error) String() string }
Regexp is a regular expression interface.
func Compile ¶
Compile compiles a regular expression.
NOTE: this function may compile the same expression multiple times and can be slow. Compile the expression once and reuse it.
func MustCompile ¶
MustCompile compiles a regular expression and panics on error.
NOTE: this function may compile the same expression multiple times and can be slow. Compile the expression once and reuse it.