title: Find repeating pattern in a string
body: <p>Suppose I have a long string:</p>
  
  <pre><code>AX 90 10 20 AX 30 14 50 ER 40 50 68 ...
  </code></pre>
  
  <p>What I need is</p>
  
  <pre><code>['AX 90 10 20', 'AX 30 14 50', 'ER 40 50 68',...]
  </code></pre>
  
  <p>I don't want to use a regex as I'll get different pattern of repetition such as the below where regex for above won't work for the below</p>
  
  <pre><code>WE 12 (09/09) ER 14 (12/56) TO 90 (45/67) ...
  </code></pre>
  
  <p>I started with creating the structural representation(converting [A-Z] to 'A' and [0-9] to '9') for the first example</p>
  
  <pre><code>AX 90 10 20 AX 30 14 50 ER 40 50 68 ...
  to
  AA 99 99 99 AA 99 99 99 AA 99 99 99 ...
  </code></pre>
  
  <p>My question is, how do I go by recognizing pattern in each string on the fly and then get the matches?</p>
  
  <p>NOTE: 
  <strong>The pattern is unknown, but it is known that some set of charcters repeat after sometime</strong></p>
  
  <p>I don't want to use regex written manually. If system generates the regex, then it would be fine.</p>