Regex to extract money including the dollar sign

Input sample : Balance $2,581,505.60
Output : $2,581,505.60

Current implementation : System.Text.RegularExpressions.Regex.Matches(“Balance $2,581,505.60”, “\d+(.\d+)*”)

Any help would be appreciated thanks.


have a look here:

1 Like

Hello @AhmedKutraphali

Try this pattern:


Hopefully this helps :blush:


@Steven_McKeering Since there is only one ouput that I expect from the regex match , how do we directly get the value without looping on the output matches ? thanks.

I tried out_put(0).ToString but it gives an error objbject reference not set to an instance of an object

@AhmedKutraphali - Try like this…

StrOutput variable type is MatchCollection

why do i get Throw: Error Occured :Object reference not set to an instance of an object.?

@AhmedKutraphali - Could you please share what you have tried?

Throw: Error OccuredError Occured :Specified argument was out of the range of valid values.
Parameter name: i

@AhmedKutraphali - Please find the starter help here… Main.xaml (5.3 KB)

1 Like

Still the same , this is the sample output from the variable

Balance I

i tried your regex on the regex build it does not highlight or even work @prasath17 @Steven_McKeering Thanks

@AhmedKutraphali - Test text is not the output…You completely messed up…I have already provided the Regex with Code…if you want Matches activity i can share a sample…

Try this format , thanks

Balance I

the format above is multi line

1 Like

@AhmedKutraphali - Main_1.xaml (6.6 KB) – Check this.

You initially gave one input , now your input is completely different . That’s why Regex had returned empty result. Please share the correct/Proper input so that we will give correct solution.


I suppose the following is better in this case, FYI.

System.Text.RegularExpressions.Regex.Matches(yourString, "(?<=Balance[\s\S]*?)\$[.,\d]+")


Hi @AhmedKutraphali

U can use


Where output_var is the output of regex matches


Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed::relaxed:

1 Like

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