According to what I see in the manuals I should be able to use regular
expressions with the rowfilter property of a dataview but I keep getting
errors.
Example:
I want to find any rowview where column APCode is not a string of exactly 3
uppercase letters.
Assume dtBAirpt is an instance of a datatable having a column APCode
Code snippet
Try
Dim dvTest As New DataView(dtBAirpt, _
"APCode NOT LIKE '[A-Z][A-Z][A-Z]'", "APCode", _
DataViewRowState.CurrentRows)
If dvTest.Count > 0 Then
For iLoop = 0 To dvTest.Count - 1
oRV = dvTest.Item(iLoop)
sRowInfo = FmtRowInfo(oRV)
AddErrorRow("INVLD STATION", sRowInfo, "ERROR")
oRV.Delete()
Next
End If
Catch ex As Exception
Console.WriteLine("Error: " & ex.Message)
End Try
Console:
Error: Error in Like operator: the string pattern '[A-Z][A-Z][A-Z]' is
invalid.
If I change the string pattern to '???' I can successfully test for 3
characters but that does not address the uppercase.
Anyone know how, or if it is possible to use a regular expression in a
dataview.rowfilter property?
Regards,
Erik