Quantcast
Channel: CodeProject Latest postings for Regular Expressions
Viewing all articles
Browse latest Browse all 224

Splitting with optionally second line

$
0
0
Hi,

I want to split the text above in three results.
Every result starts with the word "Leistung" and can optionally have a second line starting with "Zusatz".

My regex-expression ist currently this:
/Leistung [ ]*[\w\d äöüÄÖÜ]*\n[\w\d äöüÄÖÜ\*]*/gm

But this does not fit exactly.

This ist the text:
Leistung             Armeotraining ET                                                         Anzahl 1
Zusatz               *TextZusatz_Anf1*
Leistung             Atemtherapie 30                                                          Anzahl 2
Leistung             Aktivierungsgruppe                                                       Anzahl 3
Zusatz               *TextZusatz_Anf3*


The result should be:
Leistung             Armeotraining ET                                                         Anzahl 1
Zusatz               *TextZusatz_Anf1*

Leistung             Atemtherapie 30                                                          Anzahl 2

Leistung             Aktivierungsgruppe                                                       Anzahl 3
Zusatz               *TextZusatz_Anf3*


Can anyone help me with the regex-expression?
Thank you in advance!

Tobias

Viewing all articles
Browse latest Browse all 224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>