On Mon, Jan 29, 2018, Robert Thorsby wrote:
> Tadziu asked me to post my solution, so here goes. Essentially, I searched
> sequentially for ", "; the successful result gave me their position in the
> string. The four levels of search were brought about by the fact that in
> the English names for the days of the week three have 6 characters, one has
> 7, two have 8, and one has 9.
Gotta throw my two cents' worth in. Surely the simplest way to
write this (for contemporary groff) is
.ds DATE*FULL Sunday, January 28 2018
.ds FIND*COMMA \*[DATE*FULL]
.nr foo -1 1
.while 1 \{\
. substring FIND*COMMA \n+[foo] \n[foo]
. if '\*[FIND*COMMA]',' .break
. ds FIND*COMMA \*[DATE*FULL]
.\}
.ds DATE*SHORT \*[DATE*FULL]
.substring DATE*SHORT \n[foo]+2
--
Peter Schaffter
http://www.schaffter.ca