Fix rbenv gems helper

Fixes gem versions with words (beta, pre) in the version or with multiple installed versions not being highlighted, and compatibility with GNU `sed` (related to #1579).