The regular expression: (?-imsx:^(\S+)\, (\S+) (\S+) \- \- \[(\d{2})/(\w+)/(\d{4})\:(\d{2})\:(\d{2})\:(\d{2})\+(\d{4})\] \"\S+\" (\d{3}) (\d+|-) \"(.*?)\" \"\.*?\"$) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \S+ non-whitespace (all but \n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \, ',' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- \S+ non-whitespace (all but \n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- ( group and capture to \3: ---------------------------------------------------------------------- \S+ non-whitespace (all but \n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \3 ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \- '-' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \- '-' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \[ '[' ---------------------------------------------------------------------- ( group and capture to \4: ---------------------------------------------------------------------- \d{2} digits (0-9) (2 times) ---------------------------------------------------------------------- ) end of \4 ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ( group and capture to \5: ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \5 ---------------------------------------------------------------------- / '/' ---------------------------------------------------------------------- ( group and capture to \6: ---------------------------------------------------------------------- \d{4} digits (0-9) (4 times) ---------------------------------------------------------------------- ) end of \6 ---------------------------------------------------------------------- \: ':' ---------------------------------------------------------------------- ( group and capture to \7: ---------------------------------------------------------------------- \d{2} digits (0-9) (2 times) ---------------------------------------------------------------------- ) end of \7 ---------------------------------------------------------------------- \: ':' ---------------------------------------------------------------------- ( group and capture to \8: ---------------------------------------------------------------------- \d{2} digits (0-9) (2 times) ---------------------------------------------------------------------- ) end of \8 ---------------------------------------------------------------------- \: ':' ---------------------------------------------------------------------- ( group and capture to \9: ---------------------------------------------------------------------- \d{2} digits (0-9) (2 times) ---------------------------------------------------------------------- ) end of \9 ---------------------------------------------------------------------- \+ '+' ---------------------------------------------------------------------- ( group and capture to \10: ---------------------------------------------------------------------- \d{4} digits (0-9) (4 times) ---------------------------------------------------------------------- ) end of \10 ---------------------------------------------------------------------- \] ']' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- \S+ non-whitespace (all but \n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- ( group and capture to \11: ---------------------------------------------------------------------- \d{3} digits (0-9) (3 times) ---------------------------------------------------------------------- ) end of \11 ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- ( group and capture to \12: ---------------------------------------------------------------------- \d+ digits (0-9) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- - '-' ---------------------------------------------------------------------- ) end of \12 ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- ( group and capture to \13: ---------------------------------------------------------------------- .*? any character except \n (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- ) end of \13 ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- ' ' ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- \.*? '.' (0 or more times (matching the least amount possible)) ---------------------------------------------------------------------- \" '"' ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------