<?php $strings=[ 'e123f654g933c', 'e123f654g933ce99f77g66c' ]; foreach ($strings as $string) { var_export( array_map( function($v) { return preg_match_all('/[e-g]\d+/', $v, $out2) ? $out2[0] : []; }, preg_match_all('/(?:[e-g]\d+)+(?=c)/', $string, $out1) ? $out1[0] : [] ) ); echo"\n\n"; }
You have javascript disabled. You will not be able to edit any code.