Extract all Amounts from a String


Need help in getting the regex for extracting the below formats of amounts from a string?

4 450,37
4 019.04
4 022, 18
41 789,22
14 413, 21

Currently using different regex for them but can we get one of if not at least, few generalised regex?

Thanks in advance!

1 Like

Thanks @Reddy_Paluri

It helped but I am not sure how to include the amounts with spaces(last 5 amount in the screenshot). It is treating as two different amount

Can we include space in the regex for this?


You will be better off trimming those whites spaces beforehand

This is just a sample. Actual text is a form. If I trim spaces. Words and everything in a line will be combined.

Ok, try to add the \s* in your expression where the white space can appear if possible, or you will have to create an expression that will include the | in between each type of number…

i have used the Space character

Using \s* gives the entire string as result.


To be much more confident with a provided Regex pattern, it might be easier to just share a real sample or two of the form and how it appears in UiPath.

“Combining words and everything” is likely not a problem if there a constant pattern :slight_smile:

1 Like

In the form, amount can be entered in multiple places.

Attach is the one sample for the same. Third last line in the file has the 2 amount needs be extracted

1 019,52 & 1 019,52 are amount to be extracted

Thanks in advance

ExampleAmount.zip (758 Bytes)

@alpharobot Use [0-9]+[.,\V][0-9]+[.,|\V?]*[0-9]*

Thanks for providing this.

I tried and it was also matching the strings which has words, long numeric, numbers in two consecutive lines and dates of the form(22.01.2020).

I added \d instead of \V so it is not matching the words but still taking the dates.

Can this be tweaked so as to make it match the ones which has first separator as dot and then as comma (12.456,55) OR vice a versa (345,342.22) but not both separator (. and ,)in a match and before and after every separator count of number is 1 to 3

Tried for this: [0-9]+[.,\d\s{1,3}][0-9]+[.|,|\d{1,3}]*[0-9]

but unable to

Hello @alpharobot

What about this Regex solution:
Regex101 link
Regex101 with sample text. - It imght need some more refinement…
Notes: If there is text between the number then this will capture the numbers.

  1. \d,.\s ↩︎

1 Like

Hi @alpharobot Use ([\d]+[. ][\d]+[, ]*[\d]+)|([\d]+[,.][\d]+)|([\d]+[, ][\d]+[.][\d]+)

some extra unwanted result is also being captured in this regex because of they were matching with the pattern which you want to extract.
2020 0,00

1 Like

Thanks @Steven_McKeering

Have been working on this and tweaking a lil bit to get the desired result but one or the other thing is getting lost

nice to help you out


Thanks a lot @Arpit_Kesharwani

it is working fine, just that it is messing up by extracting dates. tweaking and trying on this.

Thank you so much @SamanGuruge :slightly_smiling_face:

That is working perfectly fine.

Thanks for the time and efforts!

1 Like

Hey @SamanGuruge

That’s an excellent solution. I’ve been trying to help @alpharobot with this but was not getting the regex for all the amounts formats in one.

That’s a smart solution! :smile:


Hi @rahulsharma,

Thanks, buddy :slightly_smiling_face:

1 Like

and tomorrow you get a number like this: 35,175. 23 and your crazy expression goes down the drain… in the long term, you would be better to treat your strings before hand…

1 Like