How to find a string using regex in text file


This my text file where code 00395051 appears multiple times . For every appearance I want to fetch the respective value of Credit /Debit as highlighted. Let me know how to implement this using regex expression. please provide me the solution

@Ripusudan_Sharma Can you provide that data as a Text file, so that we can verify the regex expression at our end and provide you the best solution possible.

I wish I could but due confidential document, I am not authorized to upload that text file

@Ripusudan_Sharma Based on the values that you want to get, check this link if the regex works for your Input

1 Like

02NINE647020011NADITYA BIRLA FASHION AND RETAIL LTD#RIGHTS ENTITLEMENT FOR PART PAID EQ
03M03-07-2020MOpening Balance • OOO
04M03-07 -2020MCA-Right5 Entitlement 00395051 14296
05M03-07-2020MC105ing BalanceMMM780.OOO CREDITNCN30.000M30. ooe
02NINE647020011NADITYA BIRLA FASHION AND RETAIL LTD#RIGHTS ENTITLEMENT FOR PART PAID EQ
03M03-07-2020MOpening Balance • OOO
04M03-07 -2020MCA-Right5 Entitlement
05M03-07-2020MC105ing BalanceMMM91.OO 00395051 14297 CREDITNCN91.000M91. ooe
02NINE096A01010MAPPLE FINANCE LIMITED EQUITY SHARESMMOMEQ
03M03-07-2020MOpening Balance • OOO
05M03-07-2020MC105ing BalanceMMM780.OOO
02NINE647020011NADITYA BIRLA FASHION AND RETAIL LTD#RIGHTS ENTITLEMENT FOR PART PAID EQ
03M03-07-2020MOpening Balance • OOO
04M03-07 -2020MCA-Right5 Entitlement 00395051 14297
05M03-07-2020MC105ing BalanceMMM91.OOO
02NINE096A01010MAPPLE FINANCE LIMITED EQUITY SHARESMMOMEQ DEBITNDM91 . .

this is my text you can copy in your notepad and test and help me with the solution.
Thank you.

@Ripusudan_Sharma Didn’t the regex I had provided in that link work for this data ?

(?<=00395051.+)DEBIT|CREDIT

Put that in a matches activity to return an ienumerable<matches> variable. Then iterate through each and use the match.value property to show whether it is a debit or a credit for each match

2 Likes

Thank you so much for the solution.
I need one more help with following screen shot.

Here ABC is my keyword which appears thrice. I want to get corresponding “C"or"D” value as highlighted. C = credit, D= debit
Please help me with regex expression.

Thank you so much , can you help me with the above query as well.

Is it always going to be the same amount of characters between “ABC” and the “C” or “D” that you want? Or if not, is it possible that a C or D could be in between the “ABC” and the “C” or “D” that you want?

1 Like

the position of C &D is Fixed with respect to ABC

Could you plz provide the text so that we gave test the regex for that.

Thanks

New Text Document.txt (18.1 KB)

I have uploaded the doccument file

Refer this regex

2 Likes

New Text Document.txt (18.1 KB)

This is docccument for above problem

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