title: Lua split string using specific pattern
body: <p>i need to split each row of a input file using the specific pattern " - ". I'm not so far from solution but my code actually splits also single spaces. Each row of the file is formatted as follow:</p>
  
  <p><code>NAME - ID - USERNAME - GROUP NAME - GROUP ID - TIMESTAMP</code></p>
  
  <p>name field may have spaces, same as group name and timestamp, for example a row like that</p>
  
  <p><code>LUCKY STRIKE - 11223344 - @lucky - CIGARETTES SMOKERS - 44332211 - 11:42 may/5th</code></p>
  
  <p>is valid.
  So these tokenized values should be stored inside a table.
  Here is my code:</p>
  
  <pre><code>local function splitstring(inputstr)
    sep = "(%s-%s)"
    local t={} ; i=1
    for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
        t[i] = str
        i = i + 1
    end
    print("=========="..t[1].."===========")
    print("=========="..t[2].."===========")
    print("=========="..t[3].."===========")
    return t
  end
  </code></pre>
  
  <p>when i run it, puts "lucky" in first field, strike in second field, the id inside third field. 
  Is there a way to store "lucky strike" inside first field, parsing ONLY by pattern specified?
  Hope you guys could help me.</p>
  
  <p>p.s. I already see the lua manual but didn't help me so much...</p>