diff --git a/src/Fenom/Modifier.php b/src/Fenom/Modifier.php index cf9fc57..8d9439b 100644 --- a/src/Fenom/Modifier.php +++ b/src/Fenom/Modifier.php @@ -107,9 +107,9 @@ class Modifier if (preg_match('#^(.{' . $length . '}).*?(.{' . $length . '})?$#usS', $string, $match)) { if (count($match) == 3) { if ($by_words) { - return preg_replace('#\s.*$#usS', "", $match[1]) . + return preg_replace('#\s\S*$#usS', "", $match[1]) . $etc . - preg_replace('#.*\s#usS', "", $match[2]); + preg_replace('#\s\S*$#usS', "", $match[2]); } else { return $match[1] . $etc . $match[2]; } @@ -118,7 +118,7 @@ class Modifier } else { if (preg_match('#^(.{' . $length . '})#usS', $string, $match)) { if ($by_words) { - return preg_replace('#\s.*$#usS', "", $match[1]) . $etc; + return preg_replace('#\s\S*$#usS', "", $match[1]) . $etc; } else { return $match[1] . $etc; }