You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What operating system and processor architecture are you using (go env)?
NA
What did you do?
I was trying to make an utility library like https://github.com/Miserlou/easy-expressions to
return a Go regexp but I could not use the syntax types defined in the public pkg regexp/syntax
The intended was to have an API like
re, _ := CompileRegex(Digits(), Then("."), Digits())
re.MatchString("100.99")
where re is a *regexp.Regexp that matches "+\d.+\d"
What did you expect to see?
A function to Compile a crafted syntax.Regexp
What did you see instead?
No easy way to do that
Proposal
I could see no easy way to implement it, but most of the required machinery is already in regexp module source.
Is it possible to introduce the functionfunc CompileRegexp(expr syntax.Regexp) (*Regexp, error) in the 1.9 API?
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?1.8
What operating system and processor architecture are you using (
go env
)?NA
What did you do?
I was trying to make an utility library like https://github.com/Miserlou/easy-expressions to
return a Go regexp but I could not use the syntax types defined in the public pkg regexp/syntax
The intended was to have an API like
where
re
is a*regexp.Regexp
that matches "+\d.+\d"What did you expect to see?
A function to Compile a crafted syntax.Regexp
What did you see instead?
No easy way to do that
Proposal
I could see no easy way to implement it, but most of the required machinery is already in regexp module source.
Is it possible to introduce the function
func CompileRegexp(expr syntax.Regexp) (*Regexp, error)
in the 1.9 API?The text was updated successfully, but these errors were encountered: