I think I see. All the test cases are in case the options to glimpse are changed. Wouldn't it be easier to check the options list though, rather than using various regexes? $file=$link=$rest=$title=$data=$string=$line=''; ($file, $link, $rest)=split(/$FILE_END_MARK/); ($title,$date,$string)=split(/\:\s*/,$rest); Works for me with mostly defaults.