Regular Expression Basics C# Book

using System;
using System.Text.RegularExpressions;
class Program
{
static void Main(string[] args)
{
string htmlFragment = "this is a test";
string result = Regex.Replace (htmlFragment, @"[\u0080-\uFFFF]", m => @"&#" + ((int)m.Value[0]).ToString() + ";");
Console.WriteLine (result);
}
}

The output:
this is a test