Regex - extract sum from text

Hello everyone!
How to modify the code to extract the sum from the text and write it to a variable.
For example, there is the text “Лимит овердрафта на период устанавливается в размере 500,000,000.00 руб.” How to extract only the numbers 500,000,000.00? Thanks.
Main.xaml (8.7 KB)
Расчет лимита ООО Ха-ха.xlsx (12.6 KB) Расчет лимита ООО Хо-хо.xlsx (12.6 KB)

give a try on following:

The regex could look like following
устанавливается в размере (?\d{0,3},?\d{0,3},?\d{0,3},?\d{0,3},?\d{0,3}.?\d{0,2})

To get only the numeric value you could use following statement:
strValue = new system.Text.RegularExpressions.Regex("устанавливается в размере (?<res>\d{0,3},?\d{0,3},?\d{0,3},?\d{0,3},?\d{0,3}.?\d{0,2})").Match(textdata).Groups("res").Value

My approach to regex:
1/ get the text data by saving it to a text file (e.g. using Write Text File activity)
2/ debug the regex in


Does this expression inject into the IsMatch regex builder or other activity?Thanks.

it can be used within the Match activity
or within an assign:
left side: strVal
right side: Regex.Match(YourStringVar, “(?<=xyz).*(?=abc)”).Value

ensure following:

Also have a look here:

1 Like

Thanks.If IsMatch then choose one of?
And then how to write a value (for example, 300.000.000) to a variable in the if condition?

isMatch activity returns True or false depending it the pattern was found or not.

As you are interested on the value so use as mentioned above:
Match activity:

or the statement within an assign

Used Mathes, but the output is garbage. Look here please.
Main.xaml (8.7 KB)

the pattern was just matching too much. thats the reason.

you can try:


But more recommended is that you will have a crosscheck to your data, will analyse for all possible patterns and analyse the options of finding specific markers that can be used for anchors.

The anchor is this - we use the sentence: “устанавливается в размере”. After that we take the amount of 300.000.000. How to do it?

1 Like

Doesn’t work, junk output, please take a look. Thanks.
Main.xaml (9.2 KB)

Just remove the square brackets from the regex:
[(?<= устанавливается в размере ) (\d {1,3},?+.\d{2}]


Doesn’t work without square brackets.

The square brackets are added because you use One of in the Regex Builder. Change it to Advanced to keep the builder from messing with your regular expression.


If you already have the regular expression, the best way is to avoid the Regex Builder. Just paste it in the properties panel instead (and add the double quotes).


Just paste it in the properties panel instead, but error “Matches: parsing “(?<= устанавливается в размере ) (\d {1,3},?+.\d{2}” - Nested quantifier +.”
Where did I go wrong?

Could you test to copy and paste this pattern instead:

(?<=устанавливается в размере )\d{1,3}(,\d{3})*\.\d{2}


Let’s try this…
Main.xaml (11.0 KB)


Thanks It works!

1 Like

Thanks, I just did it wrong!