En op 09 september 2002 sprak Tina Mueller: > On Mon, 9 Sep 2002, Eugene van der Pijll wrote: > > > a1z + a2z * a3z + a4z * (a5z + a6z) + a7z > > you wouldn't need two markers. a\d+ would be enough cause > after a number there will always follow a non-digit.
No, a\d+ wouldn't be enough. After the expansion of the ()'s, part of this expression would be a4z * a5 6 +z + a7z To match the second factor, we need the 'z'. a\d+ is not enough; that would only match a5. The regexp /(a.*?)[+-]a/ does find the correct term. And this is approximately what I did. Except that I didn't remove the z's; I removed the a's. So you do indeed need only one marker. > that's what our solution made: > put every innermost expression in the stack, (that means expressions > in parentheses or surrounded by '+' or '-') and replace it with > 'a'.index of stack element. <snip> > > i hope the description of our only 165 strokes-solution wasn't too boring... 165? Ha! I had a similar solution, but mine was only 131 strokes! In the post mortem, it's in the category 'Rejected'... (-ugene -- When I'm playing golf, I always expect to knock the ball into the hole. And I'm happy if the ball ends up closer to the hole than it was. -- |_arry \\/all