title: Parsing String in Java using a Pattern
body: <p>I am trying parse out 3 pieces of information from a <code>String</code>.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>text = "H:7 E:7 P:10";
  String pattern = "[HEP]:";
  
  Pattern p = Pattern.compile(pattern);
  
  String[] attr = p.split(text);
  </code></pre>
  
  <p>I would like it to return:</p>
  
  <pre><code>String[0] = "7"
  String[1] = "7"
  String[2] = "10"
  </code></pre>
  
  <p>But all I am getting is:</p>
  
  <pre><code>String[0] = ""
  String[1] = "7 "
  String[2] = "7 "
  String[3] = "10"
  </code></pre>
  
  <p>Any suggestions?</p>