In what situations would it be more appropriate to use preg_split over explode for file name manipulation in PHP?

When dealing with file names that may contain multiple delimiters or patterns, it may be more appropriate to use preg_split over explode in PHP. This is because preg_split allows for more complex splitting based on regular expressions, while explode is limited to splitting by a single string. If you need to split a file name by various delimiters or patterns, preg_split can provide more flexibility.

$filename = "example_file-2022.txt";
$parts = preg_split('/[-_\.]/', $filename);
print_r($parts);