title: How to get the container names for all possible response pattern?
body: <pre><code>sudo docker ps -a , to check the status of containers.
  </code></pre>
  
  <p>Response1:</p>
  
  <pre><code>CONTAINER ID        IMAGE                 COMMAND             CREATED             
  STATUS              PORTS                                                             
  NAMES
  3f8ac711da37        local_discourse/app   "/sbin/boot"        23 hours ago        
  Up 23 hours         0.0.0.0:80-&gt;80/tcp, 0.0.0.0:443-&gt;443/tcp, 0.0.0.0:300-
  &gt;3000/tcp   name1
  3f8ac700ba37        local_discourse/app   "/sbin/boot"        20 hours ago        
  Up 23 hours         0.0.0.0:80-&gt;80/tcp, 0.0.0.0:443-&gt;443/tcp, 0.0.0.0:300-
  &gt;3000/tcp   name2
  </code></pre>
  
  <p>I can find <code>STATUS</code> &amp; <code>NAMES</code> for <code>RESPONSE1</code>, by using <code>(.*)\s{2,}(Up.*\s+)\s{2,}(\d+\..*)\s{2,}(.*)</code></p>
  
  <pre><code>m = re.finditer('(.*)\s{2,}(Up.*\s+)\s{2,}(\d+\..*)\s{2,}(.*)', resp, re.MULTILINE)
  for i, j in enumerate(m):
      dict[m.group(4)] = m.group(2)
  </code></pre>
  
  <p>Response 2 :</p>
  
  <pre><code>3f8ac711da37        local_discourse/app   "/sbin/boot"        23 hours ago     Exited (1) 50 minutes ago    name1
  3f8ac700ba37        local_discourse/app   "/sbin/boot"        20 hours ago     Exited (135) 50 minutes ago  name2
  </code></pre>
  
  <p>I can find STATUS &amp; NAMES for RESPONSE2, by <code>(.*)\s{2,}(Exit.*\s+)\s{2,}\s{2,}(.*)</code></p>
  
  <pre><code>m = re.finditer('(.*)\s{2,}(Exit.*\s+)\s{2,}\s{2,}(.*)', resp, re.MULTILINE)
  for i, j in enumerate(m):
      dict[m.group(3)] = m.group(2)
  </code></pre>
  
  <p>I'm trying to make a common regex which gets the <code>STATUS</code> &amp; <code>NAME</code> for any kind of response (status can be <code>UP, Exit &amp; Stopped</code>). Is it possible ?</p>