Function InstrTbl(ByVal Start As Integer, ByVal Source As String, _ ByVal Table As String, Optional ByVal Include As Boolean = True, _ Optional ByVal CaseInsensitive As Boolean = False) As Integer Dim pattern As String If Include Then pattern = "[" & Table & "]" Else pattern = "[^" & Table & "]" End If Dim options As Text.RegularExpressions.RegexOptions If CaseInsensitive Then options = Text.RegularExpressions.RegexOptions.IgnoreCase End If Dim re As New Text.RegularExpressions.Regex(pattern, options)
Dim ma As Text.RegularExpressions.Match = re.Match(Source, Start) If ma.Success Then Return ma.Index Else Return -1 End If
End Function |