Jump to content
xisto Community
Sign in to follow this  

[.net]matchall Function

Recommended Posts

Public Function MatchAll(ByVal strSource As String, ByVal strStart As String, ByVal strEnd As String) As String()		Dim strSearch As String		Dim ctlRegEx As MatchCollection		strSearch = Regex.Escape(strStart) & "(?<text>(\r\n)?.*?(\r\n)?)" & Regex.Escape(strEnd)		If Regex.IsMatch(strSource, strSearch, RegexOptions.IgnoreCase) Then			ctlRegEx = Regex.Matches(strSource, strSearch, RegexOptions.IgnoreCase)		Else			Return Nothing		End If		Dim strResult(ctlRegEx.Count - 1) As String		Dim i As Long		For i = 0 To ctlRegEx.Count - 1			strResult(i) = ctlRegEx.Item(i).Groups("text").Captures(0).ToString		Next		Return strResult	End Function

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.