I have a question about Regex and UiPath.
My plan is to have a config file, where I can store all the regex patterns needed to extract specific data from pdf files.
My Excel:
Now, in UiPath studio, I want to use the Assign activities, to run that regex formula/expression
My idea is, that since myExcelvariable will have the regex expression from Excel file, the SUC value will be the result of the regex expression. Which will be a string.
I am thinking that UiPath will run the regex expression like :
Is this possible?
If no, any ideas on how to do this?
Well, if I define in studio a variable, that contain a pattern, and in my regex I add that variable, it is working.
Still, I need to troubleshoot, why is not working with the value from my excel file.
Using Write line, I can see that the value from my excel field, is correct. Still, when I add the variable based on my entry from my excel file, I do not get anything.
@wasea
often some blanks are added by the value retrieved from Excel, so use a proper toString and a trim
check in debugger /watch panel the excel row content slashed, backslashes and the plus sign is hanndled correctly
My fix seems to be double quotes for the value imported from Excel file.
“”+myvariable.ToString+“”
Anyway, this is solving half of my scenario, only the pattern.
I was thinking, if in the assign activity I can add the entire Regex expression from Excel like:
System.Text.RegularExpressions.Regex.Match(InvoiceTXT,“SUC\s+(\w+)”).Groups(1).Value.ToString
If this is not possible, well, I will stick to the pattern only.