MartinJA
(Martin Juel Andersen)
July 2, 2024, 9:35am
1
Hi there,
I have this string:
I need to split it into different sections.
The first part is to split (1), (904494) & (203139) into each of their own.
Now comes the tricky part… Then I need to split (Reline Acrylic Base), (X1),(15.00 €) and (15.00 €)
And same on next line I need (Adhesive per unit) (X2) (6.00 €), (12.00 €)
Can anyone help me with this, I have been trying all sorts of ways, but did not manage to get any good results… I always end up with it all mixed up
Thanks in advance, and best Regards,
Martin
rlgandu
(Rajyalakshmi Gandu)
July 2, 2024, 9:40am
2
@MartinJA
Write regex for this to extract the data separately instead of split.
MartinJA
(Martin Juel Andersen)
July 2, 2024, 9:41am
3
@rlgandu
Can you help me with a pattern? I suck at regex
Thanks in advance
Parvathy
(PS Parvathy)
July 2, 2024, 9:41am
4
Hi @MartinJA
Since you have already written regex to extract the line you can again write regex to extract the sub items.
Share the input and expected output separately, so that I can help you with regex.
Regards
rlgandu
(Rajyalakshmi Gandu)
July 2, 2024, 9:42am
5
@MartinJA
Please send the input text in notepad
MartinJA
(Martin Juel Andersen)
July 2, 2024, 9:46am
6
Notepad.txt (14.7 KB)
Here you go; wanted format is a explained in question
Oh, I can also give the already used RegEx Pattern if that would help;
(?<=\n|^)\s*(\d+)\s+(\d+)\s+\d+\s+([\s\S]?)(?=Case Total:\s \d+.\d{2} €\s*\n)
rlgandu
(Rajyalakshmi Gandu)
July 2, 2024, 10:26am
7
@MartinJA
[A-Z]+.*(?=\s[A-Z]+\d+\.?\d*\s\d+\.\d+\s*\€\s\d+)-->Reline Acrylic Base
[A-Z]+\d+\.?\d*(?=\s\d+\.\d+\s*\€\s\d+)-->X1
\d+\.\d+\s*\€\s(?=\d+\.)-->(15.00 €)
(?<=\€\s)\d+\.\d+\s*\€\s-->(15.00 €)
I hope this helps you.If not this works please update me.
1 Like
MartinJA
(Martin Juel Andersen)
July 4, 2024, 11:58am
8
@rlgandu
How do I use this regex on my already “regex’ed” text?
When I try using the find matching pattern acivity, it says that it needs to be a string and not a IEnumberable(Of Match).
And when I do it in a foreach it gives same error just with match instead of IEnumberable…
Thanks in advance
rlgandu
(Rajyalakshmi Gandu)
July 4, 2024, 1:45pm
9
@MartinJA
Use For each FirstMatches and currentText -->IEnumberable(Of Match)1.
use For each currentText and currentText1–>IEnumberable(Of Match)2.
Please share the screenshot of what you got the error
MartinJA
(Martin Juel Andersen)
July 5, 2024, 10:51am
10
@rlgandu
This is what I got so far (I’m only testing retrieving the data from the PDF…