How to apply filter based on row value digit count

Hi @Raja.G
You can use 2 datatables are:

dt_Valid=dt_Input.AsEnumerable().Where(Function(row) System.Text.RegularExpressions.Regex.IsMatch(row(“yyy”).ToString(),
“(00[234]\d{4}$)|([234]\d{4}$)”)).CopyToDataTable()

dt_Invalid=dt_Input.AsEnumerable().Where(Function(row) Not System.Text.RegularExpressions.Regex.IsMatch(row(“yyy”).ToString(),
“(00[234]\d{4}$)|([234]\d{4}$)”)).CopyToDataTable()

And then use them to write in different sheets.

Hoping this will be of use
Thank you

1 Like