Remove numbers from array of strings
arrays, ruby, ruby-on-rails, ruby-on-rails-3, string
Solution
Use a regexp pattern
s = ["lorem", "ipsum", "1734", "dolor", "1", "301", "et", "4102", "92"]
s.reject { |l| l =~ /\A\d+\z/ }
# => ["lorem", "ipsum", "dolor", "et"]
Problem
I have an array that looks like this: ``` ["lorem", "ipsum", "1734", "dolor", "1", "301", "et", "4102", "92"] ``` Is there a way to remove all the numbers in the array, even though they're stored as strings, so that I'd be left with this: ``` ["lorem", "ipsum", "dolor", "et"] ``` Thanks for any hints.