m/^([^\s]+) # 1st field \s ([^\s]+) # 2nd \s ([^\s]+) # 3rd \s \[([^\]]+)\] # 4th \s "([^"]+)" # 5th \s ([^\s]+) # etc. \s ([^\s]+) \s ([^\s]+) \s "([^"]+)" /x; or in regular format: m/^([^\s]+)\s([^\s]+)\s([^\s]+)\s\[([^\]]+)\]\s"([^"]+)"\s([^\s]+)\s([^\s]+)\s([^\s]+)\s"([^"]+)"/; Note: if you have any doubts, the following RE was tested on an 18725 line file and successfully parsed all lines.