-3

I need to extract information for two word tags from a list of pdfs using regular expression. The structure of every pdf would be same. I can read the whole text of pdf using UiPath activity but I need to extract only some information from that whole text using regex.

The first word tag is Wertmindernde Faktoren (in bold) and it will always have information like below (in table manner)

Please click on the link to see the image

As you can see the information is in table format and I need to use regex to extract in table format only for this particular tag.

The second tag is Gebrauchsspuren (in bold) This will have information sometimes in table format or sometimes in a sentence. Mentioned below

Table Format

Sentence Format

So any help or suggestion on what will be the regex for these two tags ?

Thanks in advance.

Please find the sample below, I need to extract the table under the word "Wertmindernde Faktoren"

Vordersitze beheizbar
Vordersitze elektrisch einstellbar, Fahrersitz mit Memory, Komforteinstieg, längs verschiebbarer
Oberschenkelauflage
Wegfahrsperre elektronisch

20.07.2021                                           Gutachtennummer: XXXXXXX                                                Seite 6 / 17TÜV SÜD Auto Plus GmbH                                    Fahrzeugbewertung
                                                          Wiesenring 2
                                                          04159 Leipzig
                                                          +XXXXXXXXXXXX
GUTACHTENNUMMER: XXXXXX
Bei Rückfragen bitte Gutachtennummer und Datum angeben                                                              Datum: 20.07.2021

Ausstattung
Zentralverriegelung ohne Safe-Sicherung,mit Funkfernbedienung, 2 Funkschlüssel, Komfortstartfunktion
"Press & Drive"

Wertmindernde Faktoren
Nr.     Bauteilgruppe                   Beschreibung
1       Heckklappe/-tür                 Heckklappe - Dellen - sanft instandsetzen

Gebrauchsspuren
Nr.     Bauteilgruppe                   Beschreibung
1       Stossfänger vorn                Spoiler (Unterhalb) - Kratzer - kein Abzug
2       Stossfänger hinten              Stossfänger hinten - Kratzer - kein Abzug
3       Tür hinten rechts               Tür - Dellen - kein Abzug
4       Tür vorn rechts                 Tür - Dellen - kein Abzug

Vorschaden
Nr.     Vorschaden                                                                                                 Schadenshöhe
1       fachgerecht repariert , Reparaturrechnung nicht vorhanden                                                            311,10 €
2       fachgerecht repariert , Reparaturrechnung nicht vorhanden                                                            493,31 €
3       Seite links, fachgerecht repariert , Reparaturrechnung nicht vorhanden

Summe (netto):                                                                                                               804,41 €

Nachlackierungen
Nr.     Ort
1       Tür vorne links, fachgerecht ausgeführt

Hinweise zum Gutachten
Angaben zum Auftrag und zum Begutachtungsumfang:
Es wurde der Auftrag erteilt, eine Fahrzeugbewertung über das beschriebene Fahrzeug zu erstellen.
Dave
  • 1
  • 5
  • What information you need to extracted ?. Can you explain which expected result you want ? –  Dec 01 '21 at 09:48
  • @TheRight Hi thanks for your comment, I need to extract the table under the words "Wertmindernde Faktoren" , the position of this table will be same for every pdf, you can find the sample below – Dave Dec 02 '21 at 12:36
  • @TheRight I have added the sample test in my edited post, please check it once, thanks – Dave Dec 02 '21 at 12:46

1 Answers1

0

Try this regex :

(?:Wertmindernde Faktoren.*)\n(.*(?:\n.+)*)

Demo

If you want that the regex match your two word try :

(?:Wertmindernde Faktoren|Gebrauchsspuren.*)\n(.*(?:\n.+)*)

Demo 2

i'm not familiar with UiPath but from here you can try like this :

Regex.Match(YourPdfText, “(?:Wertmindernde Faktoren|Gebrauchsspuren.*)\n(.*(?:\n.+)*)”).Value

look to Matches activity and here.

  • thanks for the response, this is working, do you know how I can use this in UiPath? this is not working in UiPath – Dave Dec 02 '21 at 15:01
  • Check my update –  Dec 02 '21 at 15:13
  • thanks a lot again on the response, actually I know how to put this in uipath, the issue is something else, let me explain, the uipath takes windows linebreaker as well with new line breaker so it usually comes with "sample text\r\nSomeNewLineText", thats why its not working in uipath – Dave Dec 02 '21 at 15:40