It is to find the shortest pattern, otherwise $n==1 always.
Correction: replaced $n=1 with $n==1
In reply to Re^2: Finding repeat sequences. by hdb in thread Finding repeat sequences. by BrowserUk