title: Regular expression that can describe a string
body: <p>I have an alphabet <code>{A, B, C}</code> and a (large) number of words over this alphabet:<br />
  <code>AAABBCABBCCCCAA, ABBBCCC, BBBBCACAC, ...</code> (different lengths, different combinations)</p>
  
  <p>I'm looking for a set of regular expressions (the smaller the better) that can describe these words. I prefer compact (<code>(BC)+</code> over <code>BCBC</code>). It's not homework.</p>
  
  <ol>
  <li>What's a good way to do this?</li>
  <li>Is there a Python package that already does this?</li>
  </ol>
  
  <p>I found <a href="https://stackoverflow.com/questions/7626800/finding-regular-expressions-for-languages-otherwise-described">this question</a> to be related.</p>
  
  <p><strong>Update</strong>: I might have rushed when saying I prefer <code>(BC)+</code> over <code>BCBC</code>. I prefer to have as few expressions as possible (in the worst case there is one regex per string), so preference for one of <code>A+</code>, <code>AA</code>, or <code>AA+</code> to describe <code>AA</code> (for example) should depend on what patterns other strings show.</p>