in reply to Re^2: regexp find last word
in thread regexp find last word

That's all well for the speed, but let's check correctness:

Testing string: fox comes and fox goes into forest

Holli : fox comes and the fox goes into forest Roy : fox comes and the fox goes into forest Borisz : fox comes and the fox goes into forest shltn : fox comes and the fox goes into forest

Every solution got that one right.

Testing string: fox comes fox walks and fox goes into forest

Holli : fox comes fox walks and the fox goes into forest Roy : fox comes fox walks and the fox goes into forest Borisz : fox comes fox walks and the fox goes into forest shltn : fox comes the fox walks and fox goes into forest

Three foxes trip up shltn.

Testing string: pig comes and fox goes into forest

Holli : pig comes and fox goes into forest Roy : pig comes and the fox goes into forest Borisz : pig comes and the fox goes into forest shltn : pig comes and fox goes into forest

And just one fox trips up both Holli and shltn

So I'm just going to pretend I have judging power and disqualify Holli's and shltn's entries, which makes Roy Jonhson the new winner. :)

Replies are listed 'Best First'.
Re^4: regexp find last word
by Anonymous Monk on Mar 03, 2005 at 10:46 UTC
    Testing string: fox comes fox walks and fox goes into forest. no fox left
    holli: fox comes fox walks and the fox goes into forest. no fox +left borisz: fox comes fox walks and the fox goes into forest. no fox +left sh1tn: fox comes the fox walks and fox goes into forest. no fox +left Roy Johnson: fox comes fox walks and fox goes into forest. no fox left
    And that trips both sh1tn and Roy Johnson. Leaving borisz as the only correct solution.