ruby - Get all three digit numbers from array and store in new array -
i need regular expression matches 3 digit numbers in following array. need result new array.
input:
my_array = [111,45456,456,74897,787,45466,789,6587,784,234,456,4658,4587,235,456]
desired output:
new_array = [111,456,787,789,784,234,456,235,456]
why regular expression on numbers? can select numbers less 1000 , greater 99.
my_array.select { |n| n<1000 && n>99 }
Comments
Post a Comment