- print_r: documentation ( source)
- preg_match_all: documentation ( source)
- implode: documentation ( source)
<?php
$value = "1234
4569
4560, 3333AA
3334BB
";
$allowedInputSeparators = array('\r\n', '\n', '\t', ',', ';', '|', '\s');
$pattern = '/(.+?)' . implode('|', $allowedInputSeparators) . '/';
preg_match_all($pattern, $value, $matches);
print_r($matches);