Which regex expression to use in order to be bale to select the second number of AUD?

I want to retrieve the second number that is after the word AUD

150 B AUD 3,3968 3,3982 0,7184 0,7186

So, I want to retrieve 3,3982. Which expression to use?

PS: noted that between the numbers there are space

Hi @mce ,

You Could try the below Expression :

System.Text.RegularExpressions.Regex.Match(InputString,"(?<=AUD )[\d,.]+\s+([\d,.]+)",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups(1).Value.ToString

Here, InputString variable contains the input string data.

@mce

Have a look on it->

System.Text.RegularExpressions.Regex.Matches(String_test,"(?<=AUD )[\d\.\,].+")(0).ToString.Split()(1)

thanks for your reply. How to use the System:text.RegularExpressions.Regex.Match?
Im not familiar with this

Thanks in advance for your help.

Rgds,
Maic

have a cheatsheet for regex here:

Not sure I understand how to proceed.
I prefer to use basic Expression. Is that feasible to correct the below expression to only get the 2nd number?

Thanks in advance.

your data looks like csv data so it has a potential to get it solved different.

With regex we can replace the multiple spaces with a discrete column seperator/delimeter character. This cleansed date we can parse as CSV and can continue the processing on datatable level. Can you share some sampe data as text file with us?

You could try with this expression:

(?<=AUD [\d,]+\s+)[\d,]+

image

Thanks it works with the following expression :
(?<=AUD+\s+[\d,]+\s+)[\d,]+

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