Mega Code Archive

 
Categories / VB.Net Tutorial / Regular Expressions
 

Negative Character Group

'[^aeiou]  Match all characters except vowels. '[^\p{P}\d]  Match all characters except punctuation and decimal digit characters. Imports System.Text.RegularExpressions Module Example    Public Sub Main()       Dim pattern As String = "\bth[^o]\w+\b"       Dim input As String = "thought thing though them through thus " + _                             "thorough this"       For Each match As Match In Regex.Matches(input, pattern)          Console.WriteLine(match.Value)       Next    End Sub End Module