title: Splitting String using RegEx in Android
body: <p>I've been trying to split <code>Strings</code> using RegEx with no success. The idea is to split a given music file metadata from its file name in a way so that:</p>
  
  <pre><code>"01. Kodaline - Autopilot.mp3"
  </code></pre>
  
  <p>.. would result in..</p>
  
  <pre><code>metadata[0] = "01"
  metadata[1] = "Kodaline"
  metadata[2] = "Autopilot"
  </code></pre>
  
  <p>This is the RegEx I've been trying to use in its original form:</p>
  
  <pre><code>^(.*)\.(.*)\-(.*)\.(mp3|flac)
  </code></pre>
  
  <p>From what I've read, I need to format the RegEx for <code>String.split(String regex)</code> to work. So here's my formatted RegEx:</p>
  
  <pre><code>^(.*)\\.(.*)\\-(.*)\\.(mp3|flac)
  </code></pre>
  
  <p>..and this is what my code looks like:</p>
  
  <pre><code>String filename = "01. Kodaline - Autopilot.mp3";
  String regex = "^(.*)\\.(.*)\\-(.*)\\.(mp3|flac)";
  
  String[] metadata = filename.split(regex);
  </code></pre>
  
  <p>But I'm not receiving the result I expected. Can you help me on this?</p>