using System.Text.RegularExpressions;
public static void Main()
string input = "www.google.com and http://www.google.com";
string pattern = @"\bwww.google.com\b";
string replace = "text.com";
var regex = new Regex(pattern);
string result = regex.Replace(input, replace, 1);
Console.WriteLine(result);