Extraction of specific numbers acompagned with specific string from text

Hello , i have a text which i need to extract from it a number , the format is for example
“100f” or “200fr” or “120frs” or “10.000fr” or “100FR” or “200FRS”…
I need to extract only the number beside i tried this expression and its works for the number with “f ,fr” and for the 10.000fr it retreive only the 000 after “.”

System.Text.RegularExpressions.Regex.IsMatch(mytextValue,“0-9\d{0,3})*(.\d{0,2}|)(f| f)”)

Any help please?

Thanks

Hello,

[\d\.]+(?=fr?)

image
This regex should working. Remember to use ignorcase flag in UiPath (RegexOption in properties panel for ‘Matches’ activity. At the end remove dot from regex match using ‘Replace’

1 Like

Hi,

Can you try the following expression

Check if exists

System.Text.RegularExpressions.Regex.IsMatch(mytextValue,"[.\d]+(?=\s*f)",System.Text.RegularExpressions.RegexOptions.IgnoreCase)

Extract Value

System.Text.RegularExpressions.Regex.Match(mytextValue,"[.\d]+(?=\s*f)",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value

Regards,

2 Likes

I tried it and it works onyl for the “20.000f” and its get nothing for the other ones

Thanks a lot.

Hello,

It works perfectly , thanks a lot

1 Like

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