diff --git a/src/mkvtoolnix-gui/merge/source_file.cpp b/src/mkvtoolnix-gui/merge/source_file.cpp index 6c50cbbcf..8b796e997 100644 --- a/src/mkvtoolnix-gui/merge/source_file.cpp +++ b/src/mkvtoolnix-gui/merge/source_file.cpp @@ -395,7 +395,7 @@ SourceFile::setupProgramMapFromProperties() { QString SourceFile::defaultRegexForDerivingLanguageFromFileName() { - return Q("[[({.+=#-](||)[])}.+=#-]"); + return Q("(?:^|[[({.+=#-])(||)[])}.+=#-]"); } QRegularExpression diff --git a/src/mkvtoolnix-gui/util/settings.cpp b/src/mkvtoolnix-gui/util/settings.cpp index e23b8dbf9..75b0f0d78 100644 --- a/src/mkvtoolnix-gui/util/settings.cpp +++ b/src/mkvtoolnix-gui/util/settings.cpp @@ -234,6 +234,20 @@ Settings::convertOldSettings() { reg->setValue(s_valMergeTrackPropertiesLayout, static_cast(mergeUseVerticalInputLayout.toBool() ? TrackPropertiesLayout::VerticalTabWidget : TrackPropertiesLayout::HorizontalScrollArea)); reg->endGroup(); + + // Replace default track name recognition regex valid up to 36.0.0 + // with new default one. Empty value will be replaced with actual + // new default later. + reg->beginGroup(s_grpSettings); + reg->beginGroup(s_grpDerivingTrackLanguagesFromFileNames); + auto val = reg->value(s_valCustomRegex).toString(); + + // writtenByVersion ≤ 36.0.0 → !(writtenByVersion > 36.0.0) + if ( !(version_number_t{"36"} < writtenByVersion) + && (val == Q("[[({.+=#-](||)[])}.+=#-]"))) + reg->remove(s_valCustomRegex); + reg->endGroup(); + reg->endGroup(); } void