replace text using regular expressions
Published: 24. October 2011 | Updated: 26. October 2011License: Microsoft Public License (MS-PL)
Categories: Framework » Regex
Tags: C# Regex Text
Import namespace
using System.Text.RegularExpressions;
Code
string input = "Abc123456"; string pattern = "[a-zA-Z]"; string replacement = "0"; string result = Regex.Replace(input, pattern, replacement); Console.WriteLine(result);Console Output:
000123456
| Send us feedback about this snippet » |





