Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

URL Grabber

Description
This macro will grab all of the text between [] or characters.
Language
C#.net
Minimum Version
Created By
Thomas Malloch (BFS)
Contributors
-
Date Created
Dec 17, 2015
Date Last Modified
Dec 17, 2015

Macro Code

using System;
using System.Text;
using System.Text.RegularExpressions;

public static class ClipboardFusionHelper
{
	public static string ProcessText(string text)
	{
		//this regular expression grab text between [] or <> characters
		string urlMatchRegex = "((?<=\\[).*?(?=\\]))|((?<=<).*?(?=>))";
		
		//a variable to store our modifications to the clipboard
		StringBuilder builder = new StringBuilder();
		
		//search the text for URLs
		foreach(Match match in Regex.Matches(text, urlMatchRegex, RegexOptions.IgnoreCase))
		{
			//a check to make sure we found a URL
			if(match.Length == 0)
				continue;
			
			//add the URL to the variable
			builder.AppendLine(match.ToString());
		}
		
		//return our modified text to the clipboard
		return builder.ToString();
	}
}