Mega Code Archive

 
Categories / VB.Net Tutorial / Regular Expressions
 

[p{P}d] matches all punctuation and decimal digit characters

Imports System.Text.RegularExpressions Module Example    Public Sub Main()       Dim pattern As String = "gr[ae]y\s\S+?[\s|\p{P}]"       Dim input As String = "this is a test gray grey."       Dim matches As MatchCollection = Regex.Matches(input, pattern)       For Each match As Match In matches          Console.WriteLine(match.Value)       Next    End Sub End Module