How to match words that start with M and ends with e in a string with VB.NET

1 Answer

0 votes
Imports System
Imports System.Text.RegularExpressions
 
Public Module Module1
	Sub WordsMathWith(ByVal str As String, ByVal expr As String)
        Dim mc As MatchCollection = Regex.Matches(str, expr)
        Dim word As Match
 
        For Each word In mc
        	Console.WriteLine(word)
        Next word
    End Sub
    Public Sub Main()
    	Dim str As String = "Marquee VB make net Make c programming m Mixable M Me"
     
        WordsMathWith(str, "\bM\S*e\b")
    End Sub
End Module
  
 
 
  
  
' run:
'
' Marquee
' Make
' Mixable
' Me
'

 



answered Oct 26, 2022 by avibootz
edited Oct 27, 2022 by avibootz
...