/ ^ [^.]+ \. \s # Ignore the line numbers (.+?) # Capture the file name (?: (\d) \s # Capture the optional leading size digit ) ? ( \d+ \. \d {2} # Capture the rest of the size ) \s MB .* $ /x