Regex dollar amount in the middle of the line


I am still not too familiar with regex… the situation is:

with other lines
Invoice 123456789 06/07/2018
Invoice Amount 16,127.52 USD Due 07/07/2018
Payment terms Payment in 30 Days
with other lines

I need to get 16,127.52 and there is only one USD instance. So I am thinking something like

^.*(?=(\ USD)) something \d too…

but of course it does not work…


maybe “(?<=(Amount))(.*)(?=(USD))” would work

System.Text.RegularExpressions.Regex.Match(text, "(?<=(Amount))(.*)(?=(USD))").Value.Trim

So it takes the text between “Amount” and “USD”


1 Like

Got it thanks Clayton! I understood a bit more :smiley_cat: