using System.Text.RegularExpressions;
const string pattern = @"(?<!<color=green>|[a-zA-Z0-9])(int|void|float|bool)(?!<\/color>|[a-zA-Z0-9])";
const string replacement = "<color=green>$1</color>";
public int Example(float x, bool y, int z)
someGenericMethod<int>();
public <color=green>int</color> ExamepleAlreadyReplaced(<color=green>float</color> x, <color=green>bool</color> y, <color=green>int</color> z)
someGenericMethod<<color=green>int</color>>();
return y ? (<color=green>int</color>)x : z;
public void EdgeCaseKeyWordsInNames()
var someint = int.MinValue;;
var somefloat = float.MaxValue;
var somevoid = () => { };
public static void Main()
Console.WriteLine(Regex.Replace(input, pattern, replacement));