VanjaV
1
Hi,
I need to keep in datatable only rows where “Column0” contains 6 digits.
What is wrong with following statement?
dt = dt.AsEnumerable().Where(Function (row) row(“Column0”).ToString.
Equals(System.Text.RegularExpressions.Regex.Match(row(“Column0”).ToString,“{1,6}$”))). CopyToDataTable()
Thx for suggestions and kind regards,
Vanja
J0ska
2
Better like this:
dt = dt.AsEnumerable().Where(Function (row) System.Text.RegularExpressions.Regex.IsMatch(row("Column0").ToString,"[0-9]{6}$")). CopyToDataTable()
And alos check this post
Cheers
1 Like
Hi @VanjaV
How about this expression
dt.AsEnumerable().Where(Function(s) System.Text.RegularExpressions.Regex.IsMatch(s("Column2").ToString,"\d{6}")).Select(Function(a) a).CopyToDataTable

Or
dt.AsEnumerable().Where(Function(s) s("Column2").ToString.Trim.Length.ToString.Equals("6")).Select(Function(a) a).CopyToDataTable

Regards
Sudharsan
1 Like
Hello @VanjaV
Have you checked the same with filter datatable activity?
Thanks
1 Like
system
(system)
Closed
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.