Replacing only numbers using Regex in string C#
Replacing only numbers using Regex in string C#
using System; using System.Text.RegularExpressions; public class Program { public static void Main() { Console.WriteLine("Replacing only numbers using Regex in string C#\n"); string sampleText = "I like .NET 4.5. This is awesome."; Regex regex = new Regex("[0-9]"); sampleText = regex.Replace(sampleText, "$"); Console.WriteLine(sampleText); } }DEMO
Replacing only numbers using Regex in string C#
Reviewed by Bhaumik Patel
on
7:20 PM
Rating:
