title: Replace substring with a regex combination
body: <p>Since I'm not that familiar with java, I don't know if there's a library somewhere that can do this thing. If not, does anybody have any ideas how can this be accomplished?</p>
  
  <p>For instance I have a string "foo" and I want to change the letter f with "f" and "a" so that the function returns a list of strings with values "foo" and "aoo".</p>
  
  <p>How to deal with it when there's more of the same letters? "ffoo" into "ffoo", "afoo", "faoo", "aaoo".</p>
  
  <p>A better explanation:
  (("a",("a","b)),("c",("c","d")))
  Above is a group of characters that need to be replaced with a character from the other element. "a" is to be replaced with "a" and with "b". "c" is to be replaced with "c" and "d".</p>
  
  <p>If I have a string "ac", the resulting combinations I need are:
  "ac"
  "bc"
  "ad"
  "bd"</p>
  
  <p>If the string is "IaJaKc", the resulting combinations are:
  "IaJaKc"
  "IbJaKc"
  "IaJbKc"
  "IbJbKc"
  "IaJaKd"
  "IbJaKd"
  "IaJbKd"
  "IbJbKd"</p>
  
  <p>The number of combinations can be calculated like this:
  (replacements_of_a^letter_amount_a)*(replacements_of_c^letter_amount_c)
  first case: 2^1*2^1 = 4
  second case: 2^2*2^1 = 8</p>
  
  <p>If, say, the group is (("a",("a","b)),("c",("c","d","e"))), and the string is "aac", the number of combinations is:
  2^2*3^1 = 12</p>