using System; using System.Text.RegularExpressions; public static class ClipboardFusionHelper { public static string ProcessText(string text) { Regex youtubeRegex = new Regex(@"https://www\.youtube\.com\/watch\?v\=(?<id>[^\&]*)(?:\&.*)?"); Match match = youtubeRegex.Match(text); if (!match.Success) { // If this isn't a YouTube video, don't do anything to it return text; } Group idGroup = match.Groups["id"]; string idText = idGroup.Value; return "https://youtu.be/" + idText; } }