On 16 December 2017 at 17:28, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
Never try to read regexp, it's write only
its highly susceptible to Kernighan's Lever to shoot yourself in the foot... "You separate the bullet from the gun with a hyperoptimized regexp, and then you transport it to your foot using several typeglobs. However, the program fails to run and you can't correct it since you don't understand what the hell it is you've written." http://www.toodarkpark.org/computers/humor/shoot-self-in-foot.html cheers -ben
2017-12-16 9:09 GMT+01:00 Stephane Ducasse <stepharo.self@gmail.com>:
ouaaahhhhhh ;) My problem was that I had complex lines as elements. and I will not be able to remember and express anything with regex
On Tue, Dec 12, 2017 at 4:36 PM, Martin Dias <tinchodias@gmail.com> wrote:
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 < stepharo.self@gmail.com> 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 < sean@clipperadams.com> 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