Function RegExPatternStart(strValue As String, Optional PatternText As String, Optional blnCase As Boolean = True, Optional blnBoolean = True) As String
'CHAMATCH
'Get the start position of the pattern within string
'https://stackoverflow.com/questions/8301622/excel-vba-regex-match-position
'Get the length of the pattern within string
'https://developer.rhino3d.com/guides/rhinoscript/vbscript-regexp-objects/
'20190701
Dim objRegEx As Object
Dim strPattern As String
Dim objPosition As Object
Dim strPosition As String
Dim strLength As String
' Create regular expression.
Set objRegEx = CreateObject("VBScript.RegExp")
'objRegEx.Pattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
If Len(PatternText) = 0 Then
strPattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
Else
strPattern = PatternText
End If
objRegEx.Pattern = strPattern
objRegEx.IgnoreCase = blnCase
' Do the search match.
Set objPosition = objRegEx.Execute(strValue)
strPosition = objPosition(0).FirstIndex
Debug.Print objPosition(0).Value
RegExPatternStart = strPosition
End Function
Function RegExPatternLen(strValue As String, Optional PatternText As String, Optional blnCase As Boolean = True, Optional blnBoolean = True) As String
'CHAMATCH
'Get the start position of the pattern within string
'https://stackoverflow.com/questions/8301622/excel-vba-regex-match-position
'Get the length of the pattern within string
'https://developer.rhino3d.com/guides/rhinoscript/vbscript-regexp-objects/
'20190701
Dim objRegEx As Object
Dim strPattern As String
Dim objPosition As Object
Dim strPosition As String
Dim strLength As String
' Create regular expression.
Set objRegEx = CreateObject("VBScript.RegExp")
'objRegEx.Pattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
If Len(PatternText) = 0 Then
strPattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
Else
strPattern = PatternText
End If
objRegEx.Pattern = strPattern
objRegEx.IgnoreCase = blnCase
' Do the search match.
Set objPosition = objRegEx.Execute(strValue)
strLength = objPosition(0).Length
RegExPatternLen = strLength + 1
End Function