title: Regex to split columns of an Amazon S3 Bucket Log?
body: <p>I'm setting up an ETL process for my company's S3 buckets so we can track our usage, and I've run into some trouble breaking up the columns of the S3 log file because Amazon uses spaces, double quotes, and square brackets to delimit columns.</p>
  
  <p>I found this Regex: <code>[^\\s\"']+|\"([^\"]*)\"|'([^']*)'</code> on this SO post: <a href="https://stackoverflow.com/questions/366202/regex-for-splitting-a-string-using-space-when-not-surrounded-by-single-or-double">Regex for splitting a string using space when not surrounded by single or double quotes</a> and that's gotten me pretty close.  I just need help adjusting it to ignore single quotes and also ignore spaces between a "[" and a "]"</p>
  
  <p>Here's an example line from one of our files:</p>
  
  <pre><code>dd8d30dd085515d73b318a83f4946b26d49294a95030e4a7919de0ba6654c362 ourbucket.name.config [31/Oct/2011:17:00:04 +0000] 184.191.213.218 - 013259AC1A20DF37 REST.GET.OBJECT ourbucket.name.config.txt "GET /ourbucket.name.config.txt HTTP/1.1" 200 - 325 325 16 16 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" -
  </code></pre>
  
  <p>And here's the format definition: <a href="http://s3browser.com/amazon-s3-bucket-logging-server-access-logs.php" rel="nofollow noreferrer">http://s3browser.com/amazon-s3-bucket-logging-server-access-logs.php</a></p>
  
  <p>Any help would be appreciated!</p>
  
  <p>EDIT: in response to FaileDev, the output should be any string contained between two square brackets, e.g. [foo bar], two quotes, e.g. "foo bar" or spaces, e.g. foo bar (where both foo and bar would match individually.  I've broken each match in the example line I provided into it's own line in the following block:</p>
  
  <pre><code>dd8d30dd085515d73b318a83f4946b26d49294a95030e4a7919de0ba6654c362 
  ourbucket.name.config 
  [31/Oct/2011:17:00:04 +0000] 
  184.191.213.218 
  - 
  013259AC1A20DF37 
  REST.GET.OBJECT 
  ourbucket.name.config.txt 
  "GET /ourbucket.name.config.txt HTTP/1.1" 
  200 
  - 
  325 
  325 
  16 
  16 
  "-" 
  "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" 
  -
  </code></pre>