using ArabicSupport; using System.Text.RegularExpressions; public static class ArabicFixerHelper { public static string FixPreservingTags(string rawText) { // Match … and preserve it var regex = new Regex(@"", RegexOptions.IgnoreCase); var matches = regex.Matches(rawText); string fixedText = rawText; foreach (Match match in matches) { string tag = match.Value; string placeholder = $"[[LINK{match.Index}]]"; fixedText = fixedText.Replace(tag, placeholder); } // Apply ArabicFixer to the full string with placeholders fixedText = ArabicFixer.Fix(fixedText); // Replace placeholders back with original tags foreach (Match match in matches) { string tag = match.Value; string placeholder = ArabicFixer.Fix($"[[LINK{match.Index}]]"); fixedText = fixedText.Replace(placeholder, tag); } return fixedText; } }