([^|]*)(\|[^|]+)+
I entered in the following: aaa|bbb|ccc
I expected matches[] to look like this:
What I get in matches[] is:
So the second regex group is just matches[3] and it just overwrites itself so that it only ever ends up being the last match. This brings me to the question: Is there a way to get all the matches into matches[] nicely?
I fumbled into this:
([^|]*)(|[^|]+)+
Notice the | in the middle is missing the escape character. This results in this crazy result in matches[]
Which I can process with for i = 1,#matches,6 do ... end
Debug output for this is amusing too:
Notice also matches[1] is not the full line.Alias: capture group #1 = <aaa>
Alias: capture group #2 = <aaa>
capture group #1 = <bbb>
capture group #2 = <bbb>
capture group #1 = <ccc>
capture group #2 = <ccc>