Using RegexIterator to filter values of collection

Code
<?php

$i 
= new ArrayIterator(array(1,7,9,null,40,'dude',3));

$filtered = new RegexIterator($i'/\d+/');

foreach(
$filtered as $value) {
    echo 
$value PHP_EOL;
}
Result
1
7
9
40
3
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8