Ruby: sort an array exluding some symbols

arrays, ruby, sorting

Solution

["c", "-b", "a"].sort_by{|e| e[/\w+/] }
# => ["a", "-b", "c"]

Problem

I have such an array: `["c", "-b", "a"]` `["c", "-b", "a"].sort!` returns `["-b", "a", "c"]` I want it to be sorted like `["a", "-b", "c"]` How do I exclude the minus sign from sorting? What's the simplest way to get it?

Original source