I think I actually implemented the other version, so I may be biased :), but it looks more efficient and it can handle non-identifier characters, so I'd pick that one.