Public Sub Extract( strPattern As String, strText As String, blnCaseSensitive As Boolean, intExtractGroup As Int) As String
Dim m As Matcher
If blnCaseSensitive Then
m = Regex.Matcher(strPattern, strText)
Else
m = Regex.Matcher2(strPattern, Regex.CASE_INSENSITIVE, strText)
End If
Log(m.GroupCount)
If m.Find = True Then Log("A")
If m.Find = True Then Log("B")
If m.Find = True Then Log("C")
If m.Find = True Then Log("D")
If m.Find = True Then Return m.Group(intExtractGroup)
' Return an empty string if pattern not found
Return ""
End Sub