Replacing characters, numbers using Regex in string C#

Replacing characters, numbers using Regex in string C#

using System;
using System.Text.RegularExpressions;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Replacing characters, numbers using Regex in string C#\n");
        string sampleText = "I like .NET 4.5. This is awesome.";
        Regex regex = new Regex("[a-zA-Z0-9]");
        sampleText = regex.Replace(sampleText, "$");
        Console.WriteLine(sampleText);
    }
}
DEMO
Replacing characters, numbers using Regex in string C# Replacing characters, numbers using Regex in string C# Reviewed by Bhaumik Patel on 10:53 PM Rating: 5