mardi 4 août 2015

Java regex match group empty even though it matches

Let's assume I got this line:

|125148 Schalter f GLE GÜ 90/80Z nei PL 80 16AJ

And want to match the following two parts:

  • 125148
  • Schalter f GLE GÜ 90/80Z nei PL 80

16AJ could be used as "break point" so anything from the first letter after the number until the "break point" should be matched in a group.

I got this somehow working with this regex ^\|([0-9])+(.)+(?=\s+16AJ) but my first group contains 8 characters and my second group contains nothing.

See this demo

What am I missing out here? Why is my second group empty?

Aucun commentaire:

Enregistrer un commentaire