public static function regexdelim($string, $choices = null)
{
/*
* Supply some default possibilities for delimiters if we
* weren't given an explicit list.
*/
if (!isset($choices)) {
$choices = sprintf('%c%c%c%c%c%c%c', 167, 164, 165, ord('`'), ord('~'), ord('%'), ord('#'));
}
$a_delims = str_split($choices);
/*
* Default condition is 'we didn't find one.'
*/
$delim = null;
/*
* Check for each possibility by scanning the text for it.
* If it isn't found, it's a valid choice, so break out of the
* loop.
*/
foreach ($a_delims as $tdelim) {
if (!strstr($string, $tdelim)) {
$delim = $tdelim;
break;
}
}
return $delim;
}