Regex Help to read - Merchant statement

Hi All,

I am trying to extract merchant statement which is under txt format to UIpath data table using Regex activity. I could extracted some columns highlighted in red color in below image and I stored data in UIpath data table created called “merchant_Reportdb”

However, I also need to get the “Merchant Number” to same data table as a new column.
which is highlighted in yellow color. Further, the extracted merchant number should be copied under new column call “Merchant ID” and it has to be repeat according to the row counts

Ex :

Card Number Merchant ID
455xxxxx4545 2200178
4568xxxx4558 2200178
458xxxxxx1178 2200178

Thanks in advance

Project files
BlankProcess1.zip (9.2 KB)

@Duleepa_Krishan

You can extract the Merchant Number using regex as below

(?<=MERCHANT NUMBER :).+

Save this into a Variable and use further

Hope this may help you

Thanks

Thanks @Srini84 for your reply, also do you have any Idea , that how to do it within my activity and update in to the same Uipath data table ?

thanks in advance

@Duleepa_Krishan

You can check below for your reference

Reference

Hope this may help you

Thanks

@Srini84 Hi , thanks for the reference . Also Merchant Number extraction regex is not working " (?<=MERCHANT NUMBER :).+"

if you don’t mind can you please re- look . I shared herewith the merchant statement.

2200178.txt (9.9 KB)

Hi Duleepa,

You can try to use the below regex. I modified it a bit as there are spaces between MERCHANT NUMBER and the colon after that as well, that’s why it is not working:

(?<=[MERCHANT NUMBER]\s:).+

Let us know if it helps :slight_smile:

@devricardo07 Thanks for the support , the thing is above give regex code captured several lines , pls refer to the image

I only need to get the merchant number only .

Hi,

Sorry my bad, I somehow forgot to copy the entire text while testing it. Please refer to the following regex:

(?<=[MERCHANT NUMBER]\s:)(.*)(?=\nMERCHANT NAME)

This well look for anything between MERCHANT NUMBER and MERCHANT NAME.

Hope this helps

1 Like

Hi @Duleepa_Krishan

Please give a try,

System.Text.RegularExpressions.Regex.Match("your input","(?<=MERCHANT NUMBER)[\s\d:]*").tostring.trim.replace(":","")

Thanks

2 Likes

Thanks It worked!

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