Re: [go-nuts] Re: Why can't a regexp.Regexp be const

2023-02-16 Thread Pat Farrell
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

Re: [go-nuts] Re: Why can't a regexp.Regexp be const

2023-02-14 Thread Philip Stein
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

Re: [go-nuts] Re: Why can't a regexp.Regexp be const

2023-02-14 Thread Rob Pike
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