从WebTable中获取匹配正则表达式的值的行号
Function IsRegEqual(Text, Pattern, IgnoreCase)
Dim oReg
Set oReg = New RegExp
oReg.Pattern = Pattern
oReg.Global = True
oReg.IgnoreCase = IgnoreCase
IsRegEqual = oReg.Test(Text)
End Function
Function GetRowWithRowText(oTable, Text, StartFromRow)
Dim oTableDom
'Get the DOM Object from the WebTable object
Set oTableDom = oTable.Object
'Use -1 to search in all rows
If (StartFromRow = -1) Then
StartFromRow = 0
Else
'QTP indexes are 1 based and DOM are 0 based
StartFromRow = StartFromRow - 1
End If
Dim iRow, sRowText
For iRow = StartFromRow to oTableDom.Rows.length - 1
'Get the text of the row
sRowText = oTableDom.Rows(iRow).outerText
If IsRegEqual(sRowText, Text, True) Then
'We have found the row, return it
GetRowWithRowText = iRow + 1
Exit Function
End If
Next
'No row foun
GetRowWithRowText = -1
End Function