We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When generating a slug that contains / and , , it replaces these characters with nothing, when it should correctly replace them with a separator.
/
,
separator
I modified the following code snippet:
$string = (string) \preg_replace( [ // 1) remove un-needed chars '/[^' . $separatorEscaped . $removePatternAddOn . '\-a-zA-Z0-9\s]/u', // 2) convert spaces to $separator '/[\s]+/u', // 3) remove some extras words $removeWordsSearch, // 4) remove double $separator's '/[' . ($separatorEscaped ?: ' ') . ']+/u', // 5) remove $separator at the end '/[' . ($separatorEscaped ?: ' ') . ']+$/u', ], [ '', $separator, '', $separator, '', ], $string );
To:
$string = (string) \preg_replace( [ // 1) remove un-needed chars '/[^' . $separatorEscaped . $removePatternAddOn . '\-a-zA-Z0-9\s]/u', // 2) convert spaces to $separator '/[\s]+/u', // 3) remove some extras words $removeWordsSearch, // 4) remove double $separator's '/[' . ($separatorEscaped ?: ' ') . ']+/u', // 5) remove $separator at the end '/[' . ($separatorEscaped ?: ' ') . ']+$/u', ], [ $separator, $separator, '', $separator, '', ], $string );
And it worked correctly.
The text was updated successfully, but these errors were encountered:
Ah yes, it simply strips those out by default. An easier way to add them would be to do this:
<?php require_once 'vendor/autoload.php'; URLify::add_chars ([ '/' => '-', ',' => '-' ]); echo URLify::slug ('Bomba Submersa 1/4HP 0,25 110V Lepono') . PHP_EOL;
Hope that helps!
Sorry, something went wrong.
No branches or pull requests
When generating a slug that contains
/
and,
, it replaces these characters with nothing, when it should correctly replace them with aseparator
.I modified the following code snippet:
To:
And it worked correctly.
The text was updated successfully, but these errors were encountered: