Regex data extraction

Hi,

I am fetching data from an image and getting the string output. I want to fetch a number next to a string using regex. How can I do it? Can anybody help me on this please?

I need to fetch the below number. This number will always come after the string Reference No. So I need to give a condition like fetching digits that comes in nextline to the string ‘Reference No’.

Reference No
1234567

Thanks in advance!

Kind Regards,
Renju

Hi @renjutom you can give a try like this

I put the input text in a notepad as shown below
image

in the workflow i did the following

  1. Use Read text file activity to read the above text file and store in string variable input

  2. use the below assign activity

output_index = input.Split(new String(){Environment.NewLine},StringSplitOptions.RemoveEmptyEntries).ToList.IndexOf(“Reference No”)+1

this will give the index of that number next to Reference number .

Next use message box activity to output the value like this
image

Output like this
image

overall workflow

Hope it helps you

Regards

Nived N

Happy Automation

3 Likes

You can try this regex pattern. “Reference No\n(\d*)”

1 Like

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