[GLLUG] Grep question

Andy Beverley andy at andybev.com
Thu Oct 27 14:29:32 UTC 2022


On 27/10/2022 15:02, John Levin via GLLUG wrote:
> johnl at Hasek:~/github/statutes$ grep ' [-—. ]\{3,\}$' W*/mon*.txt
> and every of them are and is hereby obliged to accept, re- ...
> 'fliqitors autj licences, — Aorb’s -----
> IPfipficians, -----
> II — -- — -.... - -- - - - —
> shall be ~ - - —
> 
> Is there something about the order of characters in regex square 
> brackets? Does the stop have a special meaning when given first?

I think it's the hyphen, which if I recall correctly has a special 
meaning if anywhere other than the beginning of the character class 
(certainly I am always in the habit of always putting hyphens at the 
beginning of character classes, if that's what I want to match).


Andy



More information about the GLLUG mailing list