title: Split string array in Java using regex
body: <p>I'm trying to split this string :</p>
  
  <blockquote>
    <p>aba(2)bb(52)gc(4)d(2)fe(14)f(6)g(8)h(4)5(6)</p>
  </blockquote>
  
  <p>so it looks like this array :</p>
  
  <blockquote>
    <p>[ a, b, a(2), b, b(52), g, c(4), d(2), f, e(14), f(6), g(8) ]</p>
  </blockquote>
  
  <p>Here are the rules, it can accept letters <strong>a to g</strong>, it can be a letter alone but if there is parentheses following it, it has to include them and its content. The content of the parentheses <strong>must be a numeric value</strong>.</p>
  
  <p>This is what I tried :</p>
  
  <pre><code>content = "aba(2)bb(52)gc(4)d(2)fe(14)f(6)g(8)h(4)5(6)";
          a = content.split("[a-g]|[a-g]\\([0-9]*\\)");
          for (String s:
               a) {
              System.out.println(s);
          }
  </code></pre>
  
  <p>And here's the output</p>
  
  <blockquote>
    <p>(2)</p>
    
    <p>(52)</p>
    
    <p>(4) (2)</p>
    
    <p>(14) (6) (8)h(4)5(6)</p>
  </blockquote>
  
  <p>Thanks.</p>