The regexp you suggested would e.g. miss the '\t'. What i tried was to address both of your initial comments (trimming space in the beginning and at the end of the string; cleaning up TiledQt-specific line-breaks).