Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find constructs a regular expression from the given struct and executes it on the given string, placing submatches into the fields of the struct. The first parameter must be a non-nil struct pointer. It returns true if the match succeeded. The only errors that are returned are compilation errors.
Types ¶
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
A Field describes how to inflate a match into a field
type Options ¶
type Options struct { Style Style // Style can be set to Perl, POSIX, or CustomStyle SyntaxFlags syntax.Flags }
Options represents optional parameters for compilation
type Pos ¶
type Pos int
Pos represents a position within a matched region. If a matched struct contains a field of type Pos then this field will be assigned a value indicating a position in the input string, where the position corresponds to the index of the Pos field.
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp is a regular expression that captures submatches into struct fields.
func Compile ¶
Compile constructs a regular expression from the struct fields on the provided struct.
func CompileType ¶
CompileType is like Compile but takes a reflect.Type instead.
func MustCompile ¶
MustCompile is like Compile but panics if there is a compilation error
func MustCompileType ¶
MustCompileType is like CompileType but panics if there is a compilation error
func (*Regexp) Find ¶
Find attempts to match the regular expression against the input string. It returns true if there was a match, and also populates the fields of the provided struct with the contents of each submatch.
type Struct ¶
type Struct struct {
// contains filtered or unexported fields
}
A Struct describes how to inflate a match into a struct
type Submatch ¶
Submatch represents a matched region. It is a used to determine the begin and and position of the match corresponding to a field. This library treats fields of type `Submatch` just like `string` or `[]byte` fields, except that the matched string is inserted into `Submatch.Str` and its begin and end position are inserted into `Submatch.Begin` and `Submatch.End`.
Directories
¶
Path | Synopsis |
---|---|
Package regex is a fork of the standard library regexp package.
|
Package regex is a fork of the standard library regexp package. |
samples
|
|
email-address
command
|
|
find-all-floats
command
|
|
floating-point
command
|
|
name-dot-name
command
|
|
python-import
command
|
|
quaternion-in-json
command
|
|
simple-email
command
|