chromatic is 100% right about the greediness part.
I did some testing (I cant say I really master regex in Perl, I just hammer them till they work :-) and this does what you want: @s=split /^\s+user: \d+\n/sm, $source; Translated to English, that is "split $source at each line starting with an number of spaces, followed by user: and a number and a newline", using the s and m modifiers to read $source as a multiline string but matching the ^ at the beggining of each line
Hope it helps.
In reply to Re: minimal greed
by jcouto
in thread minimal greed, revisited
by gregor-e
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |