Regex expression to fetch amount

Plz provide regex expression to fetch amount value.
Input may be of any below format, of which i need to fetch only the amount.
Eg: Output= 1,124.42

Input:
VAT at 20% £1,124.42
VAT at 20% £224.89
VAT at 20% £31
VAT at 20% £.534

Quick dirty pattern:
grafik

(?<=% £)[\d,.]+
1 Like

Regex is fine, but sometimes it is as simple as using the Extract Text activity:
image

This is for a single line for simplicity, but it is also possible to use the end of line character as the ending text:
image

2 Likes

Its giving null value as output.
Input_String : “REPAIRS LTD UNTIL PAID FOR IN FULL. THIS IS YOUR ORIGINAL & VAT at 20% £2,3424.89”

I am using, below expression
System.Text.RegularExpressions.Regex.Match( Input_String,“(?<=% £)[\d,.]+”).Value.Trim()

grafik
we dont get a null

Hi @nidhi.kowalli1,
If you get an error is because you dont have the library. To do that, Go to the Imports panel an include the library. follow the steps highlited in the image below:
image

Hope it helps you!

Hi @nidhi.kowalli1

Try this:
Input = "REPAIRS LTD Until PAID For In FULL. THIS Is YOUR ORIGINAL & VAT at 20% £2,3424.89"

Output = System.Text.RegularExpressions.Regex.Match(Input,"(?<=£)[\d.,].*").Value.Trim()

The same expressions will work for all your given inputs @nidhi.kowalli1

Hope it helps!!

1 Like

Thank you. It worked.
as i am working on legacy windows, I guess there was some issue.
Restarted and ran same expression. Its working!!! : smile: My Bad

1 Like

You’re welcome @nidhi.kowalli1

Happy Automation!!

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