Try to use sort like this:
arr.sort { |x,y| y <=> x }
If you need to sort by substring try something like this:
arr.sort { |x,y| y[m,n] <=> x[m,n]}
EDIT: this should work:
arr.sort do |x,y|
regex = /x[[:digit:]]+(.+?)$/
regex.match(x)[1] <=> regex.match(y)[1]
end