Based on this question, I want to extract multiple data points from a text file. The text file is basically a C# string with a Key: Value scheme. Each key-value pair is on one line. I created the following code:
var matches = Regex.Matches(
pageText,
"^Ort Lieferadresse: (?<deliveryAdress>.*)$|^Referenz: (?<reference>.*)$|^Lademittel: (?<loading>.*)$|^Plombennummer: (?<plombe>.*)$|^Bemerkung: (?<remarks>.*)$",
RegexOptions.Multiline);
This works, however I have my problems to extract the actual captures, because it returns five matches. I also tried to use the Match method, but all but the very first group are getting found.
Is there any way to return all captures in one go?
Here's some sample data:
Verladeplan
Erzeugt von: moehlerj
Erzeugt am: 01.03.2022
Ausliefertermin: 03.03.2022-01:00:00
Darstellung Verladeplan
Ladeinformationen
Ausliefertermin: 03.03.2022-01:00:00
Ort Lieferadresse: Foo
Referenz: Bar
Lademittel: 40' Container
Lademeter: 1176.000
Gesamtanzahl Paletten: 24
Gesamtbruttogewicht: 6669.0
Plombennummer: keine, da Abholung im LKW
Bemerkung: Kennzeichen: AB12345 / CD67890
Containernummer:
TARA:
Seite 1 von 2