Regular expression to read values, how to get right value?


From this i need to get 1500 + 750

" \n\t\t\t\t\t1500kr-sevillkor"
" \n\t\t\t\t\t750kr,-sevillkor"

This is working for750, but with 1500 i gett “” what should i do?
System.Text.RegularExpressions.Regex.Match(SjälvriskVindruta, “\d+(?=kr,)”).ToString

1 Like

Welcome back to uipath community
This expression will get you the result
str_input = " \n\t\t\t\t\t1500kr-sevillkor"
" \n\t\t\t\t\t750kr,-sevillkor"

str_value1 = System.Text.RegularExpressions.Regex.Matches(str_input,”[\d]+”)(0).ToString. //output will be 1500

str_value2 = System.Text.RegularExpressions.Regex.Matches(str_input,”[\d]+”)(1).ToString. //output will be 750

Cheers @Doktorgud


You cannot get value at former sentence, because there is not ", " but “-” after kr.

So, your pattern would be the following.


Regards ,

@Yoichi Thanks its working!! :smiley:

1 Like

If i have this output " \n\t\t\t\t\t2325kr"

System.Text.RegularExpressions.Regex.Match(SjälvriskVindruta, “\d+(?=kr[-,])”).ToString

this will make it “” like my other problem, so what would be the correct solution?


Can you try the following pattern?



1 Like

You are amazing!! <3