Revision: 29230
Updated Code
at July 24, 2010 02:23 by krlogin11
Updated Code
''' <summary> ''' Parses string matching regular expression ''' </summary> ''' <param name="_string">String to be parsed</param> ''' <param name="_regularExpression">Regular expresion to match</param> ''' <returns>String array matching regular expression</returns> ''' <remarks></remarks> Public Function ParseByRegex(ByVal _string As String, ByVal _regularExpression As String) As String() Dim regex As New Regex(_regularExpression, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Dim matches As Match = regex.Match(_string) If (matches.Success) Then Dim stringArray(matches.Groups.Count - 2) As String 'Skips 0 because regex.Match(0) is original string For i = 1 To matches.Groups.Count - 1 stringArray(i - 1) = matches.Groups(i).ToString Next Return stringArray End If Return Nothing End Function
Revision: 29229
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 24, 2010 02:21 by krlogin11
Initial Code
''' <summary> ''' Parses string matching regular expression ''' </summary> ''' <param name="_string">String to be parsed</param> ''' <param name="_regularExpression">Regular expresion to match</param> ''' <returns>String array matching regular expression</returns> ''' <remarks></remarks> Public Shared Function ParseByRegex(ByVal _string As String, ByVal _regularExpression As String) As String() Dim regex As New Regex(_regularExpression, RegexOptions.IgnoreCase Or RegexOptions.Singleline) Dim matches As Match = regex.Match(_string) If (matches.Success) Then Dim stringArray(matches.Groups.Count - 2) As String 'Skips 0 because regex.Match(0) is original string For i = 1 To matches.Groups.Count - 1 stringArray(i - 1) = matches.Groups(i).ToString Next Return stringArray End If Return Nothing End Function
Initial URL
Initial Description
Initial Title
Parse String Using Regex
Initial Tags
regex
Initial Language
VB.NET