Regex data extraction


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

Thanks in advance!

Kind Regards,

Hi @renjutom you can give a try like this

I put the input text in a notepad as shown below

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

Output like this

overall workflow

Hope it helps you


Nived N

Happy Automation


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.