Work on fix unneeded spaces - thx Boulder08 :)

Related to #5501
This commit is contained in:
niksedk 2021-11-20 16:05:21 +01:00
parent b894d011d1
commit 08af9eea3b

View File

@ -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(" !"))