title: Python multiple pattern matching from a log file
body: <p>I've got a log file with following format:</p>
  
  <pre><code>2016-02-18 10:01:45.423  [a-b] [one two three] [2126]
  2016-02-18 10:01:45.623  [x-y] [one two three four] [123]
  2016-02-18 10:01:45.823  [z-w] [one two three four-five] [0]
  </code></pre>
  
  <p>I'd like to split the fields into variables so that e.g. for the first line:</p>
  
  <p>Field1 = 2016-02-18</p>
  
  <p>Field2 = 10:01:45.423</p>
  
  <p>Field3 = a-b</p>
  
  <p>Field4 = one two three</p>
  
  <p>Field5 = 2126</p>
  
  <p>I'm trying to figure out how to get the two first fields as I managed to get the last 3 with the following:</p>
  
  <pre><code>&gt;&gt;&gt; import re
  &gt;&gt;&gt; data = """2016-02-18 10:01:45.423  [a-b] [one two three] [2126]"""
  &gt;&gt;&gt; PATTERN = re.compile(r'''\[(.*?)\]''')
  &gt;&gt;&gt; print (PATTERN.split(data)[1::2])
  ['a-b', 'one two three', '2126']
  &gt;&gt;&gt;
  </code></pre>
  
  <p>The content of the "Field4" may vary in length and the separator between Field2 and Field3 is 2x white space.</p>
  
  <p>How do I change the code above to capture each field?</p>
  
  <p>Thanks!</p>