Apologize if i seem to have misunderstood the requirement. I believe you want to extract the data displayed after the text ‘Presenza Vincolo Polizza’ which could be No or Si. Did you tried to use Substring to get that value.
I believe you can implement it something like this using ‘Assign’ activity,
stringArray = strFullTextString.Split(Environment.NewLine.ToArray, StringSplitOptions.RemoveEmptyEntries)
valueNoSi = strArray(0).Substring(23,2)
Thank you so much @Rammohan91.
I have to extract the data which can be Si o No, which is attached to the words “Presenza Vincolo Polizza”.
I’ll try your solution as soon as possible.
Thank you so much,
Camilla
Regex is definitely the way to go here mainly because this would warn you when something goes unexpected by default (meaning that it will only expect Si/No).
First you need to build a pattern, in our case "Presenza Vincolo Polizza (Si|No)"
Text will simply match itself, including the space (Presenza Vincolo Polizza )
Parentheses will declare a group within the pattern.
Pipe (“|”) is the ‘Or’ operator in Regex.
Using the “Matches” activity in UiPath will accept the pattern above, an input string (the raw text) and will return you an Enumerable of System.Text.RegularExpressions.Matches.
It is advised to check if you have only one match before extracting the result, A simple if will do.
Next step is to access the “Groups” property of the match, which will contain only the part you are interested in (Si/No).
It can be done bellow, We will capture index 1 as the index 0 will represent all the initial pattern matched.
Assign match = regexMatches(0)
Assign strSiNo = match.Groups(1).ToString`
Hello @Florent_Salendres.
I need to extract the two characters (Sì coassicurazione or No coassicurazione) positioned after the words: “Tipo Coassicurazione:”
*
Correct, if you would like to extract the adjacent word to SiNo.
If you want to only extract the Si No value, the previous approach should word as well by just change the begining of the pattern “Tipo Coassicurazione (Si|No)”