Yes of course.
At least your version is easier for humans to read.
In the application, I expect the whole regexp thing is trivially small part
of
the execution process. But I'm trying to write proper idiomatic go, and
yours is nicer
--
You received this message because you are subscribed to th
Related to this, couldn't it also be made case insensitive to simplify it?
https://go.dev/play/p/5qJTAcmkowg
On Tue, Feb 14, 2023, 1:51 p.m. Rob Pike wrote:
> I suggest two changes.
>
> First, always use backquotes `` around regular expressions to avoid
> misunderstandings should a backslash occ
I suggest two changes.
First, always use backquotes `` around regular expressions to avoid
misunderstandings should a backslash occur.
Second, in this case if M|m is just a choice and not a subexpression you
need to track, you can make it easier to read by using character classes to
reduce the nu
var ExtRegex =
regexp.MustCompile("(M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$")
with a
./prog.go:10:18:
regexp.MustCompile("((M|m)(p|P)(3|4))|((F|f)(L|l)(A|a)(C|c))$") (value of
type *regexp.Regexp) is not constant
Actual error I get is "error parsing regexp: unexpected ):
`(M|m)(p|P)(3|4))|(