[COFF] Requesting thoughts on extended regular expressions in grep.
Dan Cross
crossd at gmail.com
Sat Mar 4 05:09:41 AEST 2023
On Fri, Mar 3, 2023 at 12:39 PM Ralph Corderoy <ralph at inputplus.co.uk> wrote:
> > Dave Horsfall <dave at horsfall.org> wrote:
> > > # Yes, I have a warped sense of humour here.
> > > /^[JFMAMJJASOND][aeapauuuecoc][nbrrynlgptvc] [ 0123][0-9] / \
> ...
> > in particular, the original is easy to validate by just saying the
> > names of the month out loud as one scans the list.
>
> Some clients pay me to read code and find fault. It's a hard habit to
> break. ‘coc’ smells wrong. :-)
>
> A bit of vi's :map later...
>
> Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dcc
>
> The regexp works, of course, but in this case removing the redundancy
> would also fix the ‘fault’.
Ha! Good catch. I'd probably just write it as,
`(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)` which isn't much
longer than the original anyway.
- Dan C.
More information about the COFF
mailing list