Skip to content

CAFxX/restruct

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

restruct

Parse regular expressions to structs.

Go Reference

Supported conversions

Matches can be parsed into the following field types:

Example

type Foo struct {
    Bar string
    Baz float64
}

parse, _ := Compile[Foo](`(?<Bar>[a-z]+) (?<Baz>[0-9.]+)`)

foo, _ := parse(`yadda 3.14`)

fmt.Printf("%s/%.3f", foo.Bar, foo.Baz) // Output: yadda/3.140

About

Parse regular expressions to structs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages