I have a certain text like this
Input :
TOTAL FTC COST 1568324.01
TOTAL FTC COST(Trnc/Opt) 1500723.02
TOTAL MEAL COST 842359.80
TOTAL HOTEL COST 1493121.74
TOTAL TRANS COST .00
TOTAL DBLTOWN COST .00
TOTAL COST 3903805.55
I want TOTAL MEAL COST value (Example here : 842359.80)
Fine
welcome to uipath community
if the input text is
in_text = “Input :
TOTAL FTC COST 1568324.01
TOTAL FTC COST(Trnc/Opt) 1500723.02
TOTAL MEAL COST 842359.80
TOTAL HOTEL COST 1493121.74
TOTAL TRANS COST .00
TOTAL DBLTOWN COST .00
TOTAL COST 3903805.55”
then use a assign activity like
out_text = in_text.Split(Environment.Newline.ToArray())
where out_text is a string array
then use a for each row loop and mention the above variable as input and change the type argument as string in property panel
–inside use a if condition like item.contains(“TOTAL MEAL COST”)
then in the THEN part use a writeline like
Split(item," ")(3).ToString
Same with the above steps but while getting the value in loop without if condition and directly with a assign activity like this out_value = Split(item,” “)(1).Tostring.Trim
There are a lot of options to get those values, you can use https://regex101.com/ to test your regex expressions. One example (?<=_AS … )(\w|\d|\n|[(.)]| )+?(?= ) or (?<=_AS CP |FO )(\w|\d|\n|[(.)]| )+?(?= ).