The Widow's Son
11 discussion posts
Hello:
After considerable effort, I found a RegEx that will match a string that I wish removed from a clipboard capture. My question is, how do I get that to work in CF? By using a Macro?
For example, the following text is the entire clipboard capture from an Outlook Globally Unique Identifier (GUID). The portion of the text that I wish to have removed is the bolded text in that capture.
outlook:00000000C1D0ACB68AD1F6408208F54A44490FFC0700C271AE299A8A9044B0D85B9AC2B99B3C0000003EA8900000C271AE299A8A9044B0D85B9AC2B99B3C0000006EF67F0000][MESSAGE: Re: NAVAID Decommissioning (Lindbergh, Chuck (XAA))]]
So, the RegEx that matches that bold text is what's on the following line:
\]\[(.*?)\]]
How exactly should I do this? If it goes into a macro, what would be the macro code that I should use?
Thank you in advance!
the widow's son
Dec 2, 2015 (modified Dec 2, 2015)
•
#1
I was able to put together a little macro that should do what you need, and attached it to this post. .NET has a RegEx class build right into the framework, so the code is actually very simple. To use this macro, go to Settings->Macros, click the "Import" button, and select the file attached to this post.
I hope this works for you!
The Widow's Son
11 discussion posts
Mr. Malloch:
Thank you very much!
It worked perfectly. This has solved a really major multi-step workload issue for me that I repeat several times each day.
Again, thank you.
the widow's son
Dec 2, 2015 (modified Dec 2, 2015)
•
#3
The Widow's Son
11 discussion posts
Mr. Malloch:
I've been using your excellent macro for about a year. It works very well.
Sometimes, when I get the GUID from Outook, it throws in a pair of open brackets [[ at the beginning of the string. Actually, I think it is happening 100% of the time. That looks something like this:
[[outlook:00000000C1D0ACB68AD1F6408208F54A44490FFC0700C271AE299A8A9044B0D85B9AC2B99B3C0000003EA8900000C271AE299A8A9044B0D85B9AC2B99B3C0000006EF67F0000][MESSAGE: Re: NAVAID Decommissioning (Lindbergh, Chuck (XAA))]]
After running your macro, I end up with this:
[[outlook:00000000C1D0ACB68AD1F6408208F54A44490FFC0700C271AE299A8A9044B0D85B9AC2B99B3C0000003EA8900000C271AE299A8A9044B0D85B9AC2B99B3C0000006EF67F0000
What I usually do then is when I paste the result after the macro into a "add hyperlink" dialogue, I hit the home key, hit delete twice quickly and then hit enter. That works, but if I could figure out a way to remove these two leading [[ characters with this same macro, that would be best.
I'm looking around on various regex sites trying to learn more to figure this out on my own, but in the event you see this first and know of a quick solution, I would be very thankful to learn of it.
the widow's son
The Widow's Son
11 discussion posts
Actually, I think I solved it, by playing around with the macro code. This seems to work; it may not be the most efficient or most elegant, but it appears to do what I need:
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
text = Regex.Replace(text, "\\]\\[(.*?)\\]]", "");
//use the Regex class to replace any matched text with an empty string
text = Regex.Replace(text, "\\[", "");
//get ClipboardFusion to replace the text on the clipboard with the text variable
return text;
}
}
the widow's son
Glad to hear that you were able to get it sorted out!