How to find all words starts with @@ and ends with @@ in a string with VB.NET

1 Answer

0 votes
Imports System
Imports System.Text.RegularExpressions

Public Class Program
	Public Shared Sub Main()
        Dim str As String = "ms@@ @@vb@@ @@desktop @@software@@ @@development@@"
		
        Dim mc As MatchCollection = Regex.Matches(str, "@@\b\S+?\b@@")

        For Each m As Match In mc
            Console.WriteLine(m)
        Next
    End Sub
End Class

  
 
 
  
  
' run:
'
' @@vb@@
' @@software@@
' @@development@@
'

 



answered Oct 27, 2022 by avibootz
...