using System; using System.Text.RegularExpressions; public static class ClipboardFusionHelper { public static string ProcessText(string text) { //use the Regex class to replace any matched text with an empty string if (text.Contains("**")) { text = text.Replace ("**",""); text = Regex.Replace (text, @"(.*),.*- (.*),.*(\(.*)", "$1 vs $2 $3"); } else { text = Regex.Replace (text, @"\n", ""); text = Regex.Replace (text, @".*\[Date ""([1-2][0-9][0-9][0-9]).*\[White ""(.*)"".*\[Black ""(.*)"".*\[Result.*", "**$2 - $3** ($1)"); } BFS.Clipboard.PasteText(text); //get ClipboardFusion to replace the text on the clipboard with the text variable return text; } }
using System; using System.Text.RegularExpressions; public static class ClipboardFusionHelper { public static string ProcessText(string text) { if (BFS.Window.GetText(BFS.Window.GetFocusedWindow()).Contains("Chrome")) { BFS.Dialog.ShowMessageInfo("blah"); //use the Regex class to replace any matched text with an empty string if (text.Contains("**")) { text = text.Replace ("**",""); text = Regex.Replace (text, @"(.*),.*- (.*),.*(\(.*)", "$1 vs $2 $3"); } else { text = Regex.Replace (text, @"\n", ""); text = Regex.Replace (text, @".*\[Date ""([1-2][0-9][0-9][0-9]).*\[White ""(.*)"".*\[Black ""(.*)"".*\[Result.*", "**$2 - $3** ($1)"); } BFS.Clipboard.PasteText(text); //get ClipboardFusion to replace the text on the clipboard with the text variable } } return text; }