ARTICLE

How to make replacement with Regular Expressions

Posted by Praveen Kumar Articles | ASP.NET using VB.NET January 30, 2009
This simple example shows how to use Regular Expressions for replacing pattern of string.
 
Reader Level:

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

Login to add your contents and source code to this article
share this article :
post comment
 
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor