Get Number start with 2*

Hi
i have an excel it has statements.
i want to get only start with 2 number it has 10 digits.


vendorstm.xls (31.5 KB)

how to get ?

@Anand_Designer

  1. Use Read Range activity to read the data from excel file and will give output as DataTable. Let’s say ‘InputDT’.

  2. And then use below expression to get required row items.

            OutputDT = InputDT.AsEnumerable().Where(Function(row) row(0).ToString.StartsWith("2")).CopyToDataTable
    

grafik

ensure following:
grafik

Result | List(Of Datarow)=

(From d in dtData.AsEnumerable
Where Regex.isMatch(d(YourColNameOrIndex).toString.Trim, YourRegexPattern)
Select r=d).toList

If activity: Result.Count > 0
Then: dtFiltered = Result.CopyToDataTable
Else: dtFiltered = dtData.Clone

above will filter it on the requirement, when extraction is needed just combine it with a regex.Match with same pattern

Hi,

Hope the following helps you.

img20211018-6

listData.Select(Function(o) System.Text.RegularExpressions.Regex.Match(o.ToString,"^\d{10}\b").Value).Where(Function(s) not String.IsNullOrEmpty(s)).ToList()

Sample20211018-3.zip (9.8 KB)

Regards,

How to write in another sheet or how to convert this into data table ?

OutputDT Variable ??

@Anand_Designer

It is of type DataTable.