Dear list,

In cleaning up mountains of OCR'd text, I've found Grep doing something I don't undesrtand.

The aim is to locate lines ending with certain punctuation marks(-—.) and spaces. But depending on the order of those punctuation marks, I get different results. With the full stop listed first, I get two results, one of which doesn't fit the criteria; with the stop third I get 5 lines correctly matching the criteria (and I presume, all the lines that do match).

johnl@Hasek:~/github/statutes$ grep ' [.-— ]\{3,\}$' W*/mon*.txt
and every of them are and is hereby obliged to accept, re- ...
1. s. </.~|

johnl@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?

Thanks in advance,

John

--
GLLUG mailing list
[email protected]
https://mailman.lug.org.uk/mailman/listinfo/gllug

Reply via email to