Imports System
Imports System.Text.RegularExpressions
Public Class Test
Public Shared Sub Main()
Dim text As String = "red 1 green 3 blue"
Console.WriteLine(String.Join(";", Regex.Split(text, "red|green|blue")))
'Console.WriteLine(String.Join(";",
' Regex.Split(text, "red|green|blue").Where(Function(s) Not String.IsNullOrWhitespace(s))
'))
End Sub
End Class
SW1wb3J0cyBTeXN0ZW0KSW1wb3J0cyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnMKClB1YmxpYyBDbGFzcyBUZXN0CglQdWJsaWMgU2hhcmVkIFN1YiBNYWluKCkKCQlEaW0gdGV4dCBBcyBTdHJpbmcgPSAicmVkIDEgZ3JlZW4gMyBibHVlIgoJCUNvbnNvbGUuV3JpdGVMaW5lKFN0cmluZy5Kb2luKCI7IiwgUmVnZXguU3BsaXQodGV4dCwgInJlZHxncmVlbnxibHVlIikpKQoJCSdDb25zb2xlLldyaXRlTGluZShTdHJpbmcuSm9pbigiOyIsIAoJCScgIFJlZ2V4LlNwbGl0KHRleHQsICJyZWR8Z3JlZW58Ymx1ZSIpLldoZXJlKEZ1bmN0aW9uKHMpIE5vdCBTdHJpbmcuSXNOdWxsT3JXaGl0ZXNwYWNlKHMpKQoJCScpKQoJRW5kIFN1YgpFbmQgQ2xhc3M=