Extract digit value regex

hello guys i need to extract value from pdf that contain
4500043209
4500043211
4500043213
4500043215
4500043217
4500043219
4500043221
4500043223
4500043225

i already tried with [1][1-9]\d{4}.{4}$ but there is no output
help pls


  1. 4 ↩︎

Hi @Aluneth_X,

  • What is exactly the value passed to the Match activity’s RegexOption?

  • Please check in your ForEach activity that item’s type is System.Text.RegurlarExpressions.Match.

  • Check the text provided in “regex” String is as it should be (log message)

  • Check the count of matches by adding a log message before the ForEach: invoice.Count.ToString

  • Replace the Matches activity by an Assign activity for a Match type variable: System.Text.RegularExpressions.Regex.Matches(regex, "^4[1-9]\d{4}.{4}$")

1 Like

thanks dude i already tried with default option “US Phone Number” and i got all of them like for real tho

Hi @Aluneth_X welcome to Community!

I think you gave range from 1 to 9 but you have 0 also, I don’t know how whole document goes but simple [0-9]+ will do the trick.
You can find screenshot with results.

Hope this is solution for you!
Cheers!

@Aluneth_X

Would you mind try the following pattern? This will expand the matches to these numbers as long as they’re delimited like words.

\b4[1-9]\d{4}.{4}\b

hello @Aluneth_X

If you just want the number you can use this simple pattern \d{10} or \d{10}\s
it’ll get you all the digits
and if the all digits start from 45000 you can use this pattern to get more accuracy
45000\d+

thanks it worked ! anyway, there is still a little problem there are two value 4500043690 and i want only one value to get. Is it possible?

thanks it worked ! anyway, there is still a little problem there are two value 4500043690 and i want only one value to get. Is it possible?image

can i see your reply before? i want to compare my regex
thanks

hello @Aluneth_X
Yes you can see my reply
After getting your matches collection take an assign activity and assign this value
matchhes.Select(Function(r) r.value ).Distinct
it’ll get you all distinct values check this workflow for better understanding
Matches.xaml (10.0 KB)

1 Like

Wow crazy
thanks a lot man

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