Regex finding six digits

Hello friends. I’m attempting to create a regex to read the output from a pdf.

This is what I’ve tried so far by assigning it to a string:

system.Text.RegularExpressions.Regex.Match(pdfoutput,"(.*)(?=[1]{6,6})").ToString

I am trying to find PO #s from a multline code, I originally thought it was only looking at the first line so I manipulated the output to have the example and no luck there either.

I’ve tried four different ways of pulling something and the closest I got was the index being 4 away from what it was supposed to be. Any help would be appreciated.

Example: It is supposed to return what i in index 42 because it meets the above criteria. If there are dups, that is fine.

image
s


  1. 0-9 ↩︎

can you post your pdf output here/? @Thunder

HI @Thunder

You want only the 6 digit number right?
Try this pattern
system.Text.RegularExpressions.Regex.Match(pdfoutput,"\d{6}").ToString

Regards
Sudharsan

1 Like

Hello @Thunder

You can use the below regex expression to fetch the value. Use Matches activity and provide the below expression in it. You will get all the matched values.

[\d+]{6,6}

1 Like

I did try using that website and found positive matches but when I put in the code, it did not work. Those did work, is there a way to say “six digits and starts with a 6”? Thank you for your responses!

if you use the string actives in UiPath eg match or is match you view a preview of your output if you provide a sample text. this may help you

@gav_b

try to find the pattern for which you are able to uniquely identified the number 
Example -> id or any other keyword.

grafik
\b6\d{5}\b

Kindly note: Regex.Match will find the first occurrence, Regex.Matches will find all occurrences

1 Like

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