LauraMM
(Laura)
August 16, 2021, 10:34am
1
It seems like there is a discrepancy between my Regex editor and the one in UiPath. Can you help me with the below?
Input
McDonalds
Road 22
Lines
Coke 22
Sprite 33
Balance 55
Desired Output
I want everything between Lines and Balance (excluded). In this case:
Coke 22
Sprite 33
ppr
(Peter)
August 16, 2021, 10:37am
2
Simple pattern:
Value Specific pattern:
Please share more details on this with us of needed. What is different from expectations? Which pattern is used? Thanks
LauraMM
(Laura)
August 16, 2021, 10:45am
3
Sorry for not providing enough information
I need the generic pattern, that extracts:
Coke 22
Sprite 33
and
Coke 22
Fanta 44
Sprite 33
from the two input strings
McDonalds
Road 22
Lines
Coke 22
Sprite 33
Balance 55
See you
and
McDonalds
Fanta 44
Road 22
Lines
Coke 22
Fanta 44
Sprite 33
Balance 55
See you
ppr
(Peter)
August 16, 2021, 10:54am
4
Coke 22
Fanta 44
do have a pattern of many letters(UpperCase/SmallerCase) SPACE many digits
but also still valid to Road 22
As long you will not
restrict all allowed values like Fanta, Coke, Sprite…
or restrict all not allowed values like Roead, Balance…
the unneeded Matches cannot defined within the pattern. Regex is not made for recognizing what is a coke (Beverage, Menu Card Item) or a Balance (Receip line item)
In case of the scenario can be fixed more on some constraints e.g with Blockslicing/detection (find all line items e.g. end) can be additional used for extracting the unknown from the middle (then also Tea 15)
1 Like
LauraMM
(Laura)
August 16, 2021, 11:01am
5
Again sorry for not being detailed enough.
I want to match “Fanta \d{2}” and it needs to be the one that lies between Lines and Balance:
McDonalds
Fanta 44
Road 22
Lines
Coke 22
Fanta 44
Sprite 33
Balance 55
See you
PS. Fanta and two digits can appear a lot in the string, but only once between Lines and Balance, and that’s the match I want.
@LauraMM - is this your expected output?
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
When you print if you see whitespaces, just use .trimstart and .trim which will strip all the whitespaces
1 Like
LauraMM
(Laura)
August 16, 2021, 12:13pm
7
Thanks a lot for helping me. No, I need only the Fanta \d{2}, but it needs to be the one between Lines and Balance (the digits can vary).
This is what you asked Initially…
1 Like
system
(system)
Closed
August 19, 2021, 12:20pm
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.