If your input was a string instead of a list of lines, you had:

'[^4]*4|.+' asRegex matchesIn: '1234123123456'
>>>
 "an OrderedCollection('1234' '1231234' '56')"

Martín

On Tue, Dec 12, 2017 at 9:33 AM, Stephane Ducasse <[email protected]>
wrote:

> Thanks sean.
> I will build it because for example I had list of lines and I needed
> to split the input depending
> on patterns inside the lines.... and sadly this was not for an advent of
> code.
>
> Rmoders suggested
> aggregateRuns:
> splitOn:
> but this is not the same.
>
>
> Stef
>
> On Tue, Dec 12, 2017 at 2:33 AM, Sean P. DeNigris <[email protected]>
> wrote:
> > Stephane Ducasse-3 wrote
> >> #(1 2 3 4 1 2 3 5 6 ) consumeUntil: [:each | each = 4)
> >>>>> {#(1 2 3 4) . #( 1 2 3 5 6 )}
> >
> > The shortest kernel thing I could come up with took two steps: `{ #(1 2
> 3 4
> > 1 2 3 5 6 ) copyUpThrough: 4.
> > #(1 2 3 4 1 2 3 5 6 ) copyAfter: 4 }`. The splitting messages seem to all
> > eat the separator.
> >
> >
> >
> > -----
> > Cheers,
> > Sean
> > --
> > Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.
> html
> >
>
>

Reply via email to