php - Make a multiple delimiter REGEX for preg_split -
i need split multiple lines in multiple files different delimiters. think preg_split should job never worked pcre regex stuff. change delimiters consistent adds unnecessary calculations.
q: delimiters consist of (,)(;)(|)(space) , curious how build such regex.
put characters in square brackets []
:
$parts = preg_split('/[,;| ]/', $string, null, preg_split_no_empty);
you can use \s
instead of space character, matches kinds of whitspace, such tabs , newlines.