Hi all,
I am having an issue related to regex at reading pdfs:
I want to get the name of car. From Sportage or Kia until the last character before the amount. The issue is that sometimes there is “(MYXX)” and if I put the following code, it gets all you can see:
(?<=^\w{17}\s+)[\w.-,\s]+[\s(\w)]+
How could I do it?
Thanks
Yoichi
(Yoichi)
June 23, 2021, 7:02am
2
Hi,
Can you try the following pattern?
(Sportage|KIA).+?\(.*?\)
or
(?<=[A-Z0-9]{17}\s).+?\(.*?\)
Regards,
1 Like
Thanks @Yoichi !! Could you explain me what is it doing “.+?(.*?)”? As it is first time I see it
Many thanks!!
Yoichi
(Yoichi)
June 23, 2021, 7:13am
4
Hi,
.+?\(.*?\)
In this case, ?
means lazy quantifier. Please check the following document.
Learn about regular expression quantifiers, which specify how many instances of a character, group, or character class must be present in the input to match.
And \
is for escaping parenthesis.
Regards,
2 Likes
Hello,
I am doing this regex code, and it works in regexr.com but in Uipath the output is empty, and I have activated multiline option:
UiPath: system.Text.RegularExpressions.Regex.Match(pdf, “(?<=^\d{6,}\s[*,\w,\s,,]+[\d,,.]+\s[\d,,.]+\s\w\s[\d,,.]+\s(.*?))[\d,,]+$”, RegexOptions.Multiline).Value.ToString
Do you know why is empty in UiPath?
Thanks
Yoichi
(Yoichi)
June 23, 2021, 9:53am
6
Hi,
It might be line break matter.
Can you add \r?
at the end of the pattern as the following?
[\d,\,]+\r?$
Regards,
1 Like
system
(system)
Closed
June 26, 2021, 9:58am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.