How to get text before the amount from Regex?

Hi Experts,

Hope you all are well.

I need some help regex.
Input String -
29 NOV VISA PURCHASE 27/11/16 59.99 2,405.99
30 NOV VISA PURCHASE 28/11/16 761.98 1,644.01
30 NOV VISA PURCHASE 29/11/16 822.00 822.01
02 DEC VISA PURCHASE 01/12/16 14.99 807.02
03 DEC VISA PURCHASE 01/12/16 5.50 801.52
27 NOV OPENING BALANCE 465.98

Output:
VISA PURCHASE 27/11/16
VISA PURCHASE 28/11/16
VISA PURCHASE 29/11/16
VISA PURCHASE 01/12/16
VISA PURCHASE 01/12/16
OPENING BALANCE

Need some help here.
@prasath17

Hi,

Try this https://regex101.com/r/wFYtZR/1

Hi @Jorge_Cavalcante ,

Thanks for the response but it is not selecting last string that is “Opening Balance”.

And their can be any text inside it is not always VISA.

image

https://regex101.com/r/wFYtZR/1

Do you just need the “Opening Balance”? I did an Update on Regex.

Thanks again but the text can be dynamic not always that you have hardcoded.
I want it should pick dynamically whatever the text is present there.

@ermanoj3101 - Could you please check this…

https://regex101.com/r/aNzpnt/1/

Thank you it’s working.

1 Like

Hi @prasath17 ,

I forgot to mention that string also have below criteria

Input:
28 NOV INTERNET DEPOSIT 28NOV 13:38 1,000.00 1,465.98
29 NOV INTERNET DEPOSIT 13:50
30 NOV INTERNET DEPOSIT 29NOV

Output:
INTERNET DEPOSIT 28NOV 13:38
INTERNET DEPOSIT 13:50
INTERNET DEPOSIT 29NOV

Can you please help me what i need to add to existing regex?

Thanks.

Sure. Let me try. But on the first look, it is going to be complex/impossible. So want all the bolded text from the below right??

29 NOV VISA PURCHASE 27/11/16 59.99 2,405.99
30 NOV VISA PURCHASE 28/11/16 761.98 1,644.01
30 NOV VISA PURCHASE 29/11/16 822.00 822.01
02 DEC VISA PURCHASE 01/12/16 14.99 807.02
03 DEC VISA PURCHASE 01/12/16 5.50 801.52
28 NOV INTERNET DEPOSIT 28NOV 13:38 1,000.00 1,465.98
29 NOV INTERNET DEPOSIT 13:50
30 NOV INTERNET DEPOSIT 29NOV
27 NOV OPENING BALANCE 465.98

Right
You can ignore INTERNET DEPOSIT 13:50

@ermanoj3101 - Please check this…Only Opening Balance is not correct. See if you can use string manipulation/regex to replace that value…

https://regex101.com/r/aNzpnt/3/

I will also try…

1 Like

Thank you so much, this looks fine.
I will replace that amount.

1 Like

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