Replacement with Regular Expressions in ASP.NET using VB.NET
This simple example shows how to use Regular Expressions for replacing pattern of string.
This simple example shows how to use Regular Expressions for replacing pattern of string.
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Text.RegularExpressions
Namespace WindowsApplication1
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim digitrex As Regex = New Regex("(?<digit>[0-9])")
Dim text1 As String = textBox1.Text.ToString()
Dim resulttext As String = digitrex.Replace(before, "")
textBox2.Text = resulttext
End Sub
End Class
End Namespace