Question: I have an array that I am looping through and pushing specific values to a separate array. EX:

```
first_array = ["Promoter: 8", "Passive: 7"]

```

I want to push every value that is an integer to a separate array, that would look like this in the end:

```
final_array = [8,7]

```

It would be nice for the values in the new array to be integers. I can't think of a way to push all numeric values within a string to a new array, but what would be the best option to do what I am wanting?

Answer: 
And I have to add this super short but complicated one-liner solution:

```
a = ["Promoter: 8", "Passive: 7"]
p a.grep(/(\d+)/){$&.to_i} #=> [8,7]

```
If the integer part of each string in (which look like members of a hash) is always preceded by at least one space, and there is no other whitespace (other than possibly at the beginning of the string), you could do this:

```
first_array = ["Promoter: 8", "Passive: 7"]
Hash[*first_array.map(&:split).flatten].values.map(&:to_i) # => [8,7]

```

* map first\_array => [["Promoter:", "8"], ["Passive:", "7"]]
* flatten => ["Promoter:", "8", "Passive:", "7"]
* convert to hash => {"Promoter:" => "8", "Passive:" => "7"}
* get hash values => ["8", "7"]
* convert to ints => [8, 7]

Note the need for the splat:

```
 Hash[*["Promoter:", "8", "Passive:", "7"]]
   => Hash["Promoter:", "8", "Passive:", "7"]                                               
   => {"Promoter:" => "8", "Passive:" => "7"} 

```