Imports System.Text.RegularExpressions
Imports System
Public Class MainClass
Shared Sub Main()
Dim testString1 As String = "This sentence ends in 5 stars *****"
Dim testString2 As String = "1, 2, 3, 4, 5, 6, 7, 8"
Dim testRegex1 As Regex = New Regex("stars")
Dim testRegex2 As Regex = New Regex("\d")
Console.WriteLine("Original String 1" & vbTab & _
vbTab & vbTab & testString1)
testString1 = testRegex1.Replace(testString1, "carets")
Console.WriteLine("""carets"" substituted for " & _
"""stars""" & vbTab & testString1)
End Sub ' Main
End Class
|