can someone help me with regex, I have been trying to get the data from a pdf file and I cant seem to get the right regex for it.
I just want to get the names as highlighted and ignore *,A,B,C,ABC and all the rest to the right with long white space. Initially I got this regex:
[A-ZÑ ]+,\s\w*[A-ZÑ]\s\w*A-ZÑ.
Hi.
How many spaces or other white characters are between names (BERNANDO DABALOS) and column on the right (BALATGUTI)?
It will be helpfull information, which we need to separate words from the column on the right
Vikas_M
(Vikas M)
August 4, 2023, 8:50am
3
Hey @Jhun_III_Daganzo ,
Try the below regex it might help you out
([A-Za-z]+, [A-Za-z]+\s[A-Za-z]+\.[A-Za-z]+)|([A-Za-z]+, [A-Za-z]+)
Below is the output screenshot
Hope it helps you out
mkankatala
(Mahesh Kankatala)
August 4, 2023, 8:53am
4
Hi @Jhun_III_Daganzo
Provide the Input data as text then it will help us to extract the data easily.
1 Like
Thanks for the help but it still does not capture when using multiline.
Here-> regex101: build, test, and debug regex
Vikas_M
(Vikas M)
August 4, 2023, 10:07am
8
@Jhun_III_Daganzo ,
Can you once try with below regex
\b\w+, \w+(?: \w+)?(?: \w+)?(?: \w+)\b
Its almost capturing the data but it still captures the data from the right with long spaces. Is there a way to not capture the data after a long space?
Vikas_M
(Vikas M)
August 4, 2023, 10:17am
10
$ symbol will capture till end of the string
try with the below regex
\b\w+, \w+(?: \w+)?(?: \w+)?(?: \w+)?(?=\s|$)\b
mkankatala
(Mahesh Kankatala)
August 4, 2023, 10:28am
11
Hi @Jhun_III_Daganzo
Check the below regular expression
[A-Z]+\,\s+[A-Z]+\s+[A-Z]+\s{1}[A-Z]+|[A-Z]+\,\s+[A-Z]+\s+[A-Z]+|[A-Z]+\,\s+[A-Z]+.*\s+[A-Z]+\s{1}[A-Z]+
Hope it helps!!
mkankatala:
[A-Z]+\,\s+[A-Z]+\s+[A-Z]+\s{1}[A-Z]+|[A-Z]+\,\s+[A-Z]+\s+[A-Z]+|[A-Z]+\,\s+[A-Z]+.*\s+[A-Z]+\s{1}[A-Z]+
Thank you for your help. I really appreciate it.
mkankatala
(Mahesh Kankatala)
August 4, 2023, 10:39am
13
Thank you @Jhun_III_Daganzo
Hope you find the solution. Make mark it as solution to close the loop.
Happy Automation!!
system
(system)
Closed
August 7, 2023, 10:40am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.