We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/json
See this comment #269 (comment)
package main import ( "fmt" "log" "regexp" "gopkg.in/yaml.v3" ) type Foo struct { Thing string Regex *regexp.Regexp } func main() { /* f := Foo{Regex: regexp.MustCompile(`\s+some`)} byt, err := json.Marshal(f) if err != nil { log.Print(err) return } fmt.Println(string(byt)) f2 := new(Foo) err = json.Unmarshal([]byte(`{"Regex": "\\s+some"}`), f2) if err != nil { log.Print(err) return } fmt.Println(f2.Regex.MatchString(` some`)) */ f3 := new(Foo) err := yaml.Unmarshal([]byte("Regex: '\\s+some'\n"), f3) fmt.Println(f3) if err != nil { log.Print(err) return } fmt.Println(f3.Regex.MatchString(` some`)) }
The text was updated successfully, but these errors were encountered:
On the Go Playground: https://go.dev/play/p/Tgl4GSNjN8O
Sorry, something went wrong.
No branches or pull requests
See this comment #269 (comment)
The text was updated successfully, but these errors were encountered: