not sure if this is a hot path, but maybe always `explode` and afterwards checking if $delim was found and used might be faster