How to extract partial data from a bank account with regex?

Good afternoon friends;

A question please, is there a way to recognize these patterns so that I can later complete the account number?

In each voucher it comes in a different way, but I would like to recognize the pattern “475…033” that is, any pattern that starts in 475 and ends in 033, but as you will see in one of the vouchers it comes with empty spaces, in others with (-)

The numbers to extract are highlighted in yellow, I only put a fragment of the image to indicate how the accounts come.

First voucher:

imagen

Second voucher:

imagen

Third voucher:

imagen

Full text of each voucher:

First voucher:
3:11 ☐ Vo)) O .ll 92% ☐ LTÉ X ☐ Financiera Kall S.a. recibió: P/ 92.00 Martes 17 2022 Mayo 15:11 Destino Financiera Kall S.a. Banco BCP - 475 1433773 0 33 Moneda Soles Origen Ahorro Pesos 193 39659874 0 76 Número de operación 44255919 III ☐ <

Second voucher:
BCP DEPOSITO CUENTA CORRIENTE MNA OF./191085-085B-T08766 OP-0685538 29/01/2022 Hora:09:37:33 FINANCIERA Kall S.A. CODIGO DE CUENTA: 475-1433773-0-33 CCI 00247500143377303328 : IMPORTE DEPOSITADO: x**x1,362.59

Third voucher:
BCP> Financiera Efectiva S.a. 7,010.00 Jueves 19 2022 Mayo 17:47 Destino Financiera Kall S.a. Banco BCP 475 = 0 33 Moneda Pesos Número de operación 57245685 Origen Ahorro Soles ******** 191 0 70

Hi @Lynx

Can we latch onto any words? Take a look here at this pattern.

If you want all three, then here is another pattern.

NOTE: You will need additional follow up steps to check for invalid characters.

Hopefully this helps.

Cheers

Steve

1 Like

Thank you very much @Steven_McKeering, it helped a lot! :slight_smile:

1 Like

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