Try the following code:
$str = trim($str); $strlength = strlen($str); if (strcasecmp(substr($str, ($strlength-5), $strlength), 'blank') == 0) echo $str = substr($str, 0, ($strlength-5))
Do not use preg_match unless required. PHP itself recommends using string functions over regular expression functions when matching is simple. From the preg_matc h. Man page.
user319198
source share