mholt / json-to-go

Translates JSON into a Go type in your browser instantly (original)
https://mholt.github.io/json-to-go/
MIT License
4.51k stars 475 forks source link

Error on parsing regExp as String #88

Closed pittidoe90 closed 3 years ago

pittidoe90 commented 3 years ago

If you try to parse a regExp within a string it returns a error.

for example:

{"regExp":"\d+"}

image

mholt commented 3 years ago

Pretty sure \d is not a valid escape sequence; see https://jsonlint.com/. You need \\d for a literal backslash.