From 08af9eea3b70005cfca3f37f4698284f3516c9e8 Mon Sep 17 00:00:00 2001 From: niksedk Date: Sat, 20 Nov 2021 16:05:21 +0100 Subject: [PATCH] Work on fix unneeded spaces - thx Boulder08 :) Related to #5501 --- src/libse/Common/Utilities.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libse/Common/Utilities.cs b/src/libse/Common/Utilities.cs index f63a8999d..2e709ef89 100644 --- a/src/libse/Common/Utilities.cs +++ b/src/libse/Common/Utilities.cs @@ -25,6 +25,7 @@ namespace Nikse.SubtitleEdit.Core.Common private static readonly Regex NumberSeparatorNumberRegEx = new Regex(@"\b\d+[\.:;] \d+\b", RegexOptions.Compiled); private static readonly Regex RegexIsNumber = new Regex("^\\d+$", RegexOptions.Compiled); private static readonly Regex RegexIsEpisodeNumber = new Regex("^\\d+x\\d+$", RegexOptions.Compiled); + private static readonly Regex RegexNumberSpacePeriod = new Regex(@"(\d) (\.)", RegexOptions.Compiled); public static string[] VideoFileExtensions { get; } = { ".avi", ".mkv", ".wmv", ".mpg", ".mpeg", ".divx", ".mp4", ".asf", ".flv", ".mov", ".m4v", ".vob", ".ogv", ".webm", ".ts", ".m2ts", ".mts", ".avs", ".mxf" }; public static string[] AudioFileExtensions { get; } = { ".mp3", ".wav", ".wma", ".ogg", ".mpa", ".m4a", ".ape", ".aiff", ".flac", ".aac", ".ac3", ".eac3", ".mka" }; @@ -2179,6 +2180,11 @@ namespace Nikse.SubtitleEdit.Core.Common text = new Regex(@"([0456789]) (th)\b").Replace(text, "$1$2"); } + if ("en-da-es-sv-de-nb-cz".Contains(language) && text.ContainsNumber()) + { + text = RegexNumberSpacePeriod.Replace(text, "$1$2"); + } + if (language != "fr") // special rules for French { if (text.Contains(" !"))