3v4l.org

run code in 300+ PHP versions simultaneously
<?php $yourstring='C7,22801422CFE0F63,2280141C5EF0F63,22801402EFD0F63,2280138C5ED0F63,228024329897530,228023829877530'; $pattern = '~ (?!^)(\h*,\h*(?<value>[0-9]{7}[A-F0-9]{8})) | (?<first>[a-zA-Z0-9]+)(?=(?1)*$) ~xA'; if ( preg_match_all($pattern, $yourstring, $matches) ) { echo $matches['first'][0], PHP_EOL; print_r(array_values(array_filter($matches['value']))); }

preferences:
53.13 ms | 402 KiB | 5 Q