I need this to be done in Oracle SQL (10gR2). But I guess, I would rather put it plainly, any good, efficient algorithm is fine.
Given a line (or sentence, containing
I'm not sure if you can use a regex in oracle, but wouldn't
(\w+)\W*$
work?