Correct regular expr. and add empty line at the end of file