I've got a bit of a problem with coming up with the correct regex. I had to create a regex for the following text: Feld1 = 1134 2000 0101 0202 0303
Name1 = Ein Kleiner Namens Test
Daten1 = 2200220
VWZ =
Name2. =
Daten2 = 1100110
The regex has to find all keys and appropriate values and store them in the matches. So far so good. ([\s]+(?[^\s]+)[\s]+=[\s]+(?[^\r\n]+)) did a very nice job there. With one exception: If a value is empty it doesnt recognize it and thinks the key+value of the next line is the value it should assign to the key.
I experimented and found some regex that would rectify this problem BUT it would put the space after the = also into the regex. TRy as I might I'm not finding a regex that solves both situations so that I just get the correct key, value pairs:

The question would be what am I doing wrong and how do I need to modify the regex to achieve my goal?
