This simple example shows how to use Regular Expressions for replacing pattern of string.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Regex digitrex = new Regex("(?<digit>[0-9])");
string text1 = textBox1.Text.ToString();
string resulttext = digitrex.Replace(before, "");
textBox2.Text = resulttext;
}
}
}