diff --git a/framework/helpers/BaseInflector.php b/framework/helpers/BaseInflector.php index 8ba8927..fd3deb4 100644 --- a/framework/helpers/BaseInflector.php +++ b/framework/helpers/BaseInflector.php @@ -480,8 +480,8 @@ class BaseInflector $parts = explode($replacement, static::transliterate($string)); $replaced = array_map(function ($element) use ($replacement) { - $element = preg_replace('/[^a-zA-Z0-9=\s—–]+/u', '', $element); - return preg_replace('/[=\s—–]+/u', $replacement, $element); + $element = preg_replace('/[^a-zA-Z0-9=\s—–-]+/u', '', $element); + return preg_replace('/[=\s—–-]+/u', $replacement, $element); }, $parts); $string = trim(implode($replacement, $replaced), $replacement); diff --git a/tests/framework/helpers/InflectorTest.php b/tests/framework/helpers/InflectorTest.php index 4ff72c2..257b64e 100644 --- a/tests/framework/helpers/InflectorTest.php +++ b/tests/framework/helpers/InflectorTest.php @@ -187,7 +187,8 @@ class InflectorTest extends TestCase { $this->assertEquals('dont_replace_replacement', Inflector::slug('dont replace_replacement', '_')); $this->assertEquals('remove_trailing_replacements', Inflector::slug('_remove trailing replacements_', '_')); - $this->assertEquals('thisrepisrepreplacement', Inflector::slug('this is REP-lacement', 'REP')); + $this->assertEquals('thisrepisreprepreplacement', Inflector::slug('this is REP-lacement', 'REP')); + $this->assertEquals('0_100_kmh', Inflector::slug('0-100 Km/h', '_')); } public function testSlugIntl()