How to get only 6 and 10 digits

Hi,
i want to extract only 6 and 10 digit data.my data is stmt.xlsx (8.5 KB)
output is like

Please use Left or Right function… depends on your size of the number…

Hi @sayli,

Use Regex pattern to get the data
https://regex101.com/r/qnvnOo/1
(?<=[ |_])(\d{10} |\d{6} )

Regards,
Arivu

1 Like

no it took first 6 digits from 10 digit numbers. i want only 6 and 10 digits numbers not first 6

Try using String.Length and check if the length is equal to 6 or 10 .

Left(String,6)

i tried but it took 7 digits as well i will share my workflowUjjivan_Bank.xaml (32.0 KB)

@sayli,

Solved your problem, please find your solution in the attachment:- Sayli_Solution.zip (20.0 KB)
(kindly check the stmt.xlsx file before and after execution)

Please mark as solution if it helped you.

Thanks and Regards,
@hacky

1 Like

it might be because the Indexing starts at 0 when you count the length if you give 6 it will give you 7 Characters. for 6 chars you need to check if the length equals 5.

thanks a lot


I Tried your solution but its not showing some expression well, pls check oncestmt.xlsx (7.8 KB)

@salyi

I have created the regex with respect to the first 6 entries that you had provided us with.
(PLEASE REFER THE SCREENSHOT THAT YOU GAVE BEFORE)
Following the conditions:-

  • “_” before the number in A2 and " " after number
  • " " before and after the number in A5 and A6

As I see, to have newer entries also to be satisfied, you need to modify the regex accordingly.
(PLEASE REFER THE SCREENSHOT THAT YOU GAVE NOW)
The solution failed because of the following reasons:-

  • As you can see, in your A9th cell, there is “” before the number. Same in A15th cell.
  • And also, in the A20th cell, there is “/” sign before and after the number.

So above are the reasons it failed.

Please make the modifications in the Regex according to your convenience.

Thanks and Regards,
@hacky

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.