Answers for "regular expression to make slug for local language"

0

regular expression to make slug for local language

//this slug with encoding for any language 
         function CleanURL($string, $delimiter = '-') {
            // Remove special characters
    $string = preg_replace("/[~`{}.'\"\!\@\#\$\%\^\&\*\(\)\_\=\+\/\?\>\<\,\[\]\:\;\|\\\]/", "", $string);
        
            // Replace blank space with delimeter
            $string = preg_replace("/[\/_|+ -]+/", $delimiter, $string);
        
            return $string;
 
        }

        $slug=CleanURL($request->title);
        $post->slug=$slug;
Posted by: Guest on June-12-2021

Code answers related to "regular expression to make slug for local language"

Browse Popular Code Answers by Language