<?php $tests = [ 'file_name_here1.txt', 'some_other-file10.txt', 'file_name_1__123.txt', 'this_file_name_2__456.txt', ]; foreach ($tests as $test) { preg_match('/(.+?)(\d+)\.\w+$/', $test, $m); var_dump(array_slice($m, 1)); }
You have javascript disabled. You will not be able to edit any code.