Gossamer Forum
Quote Reply
Regex Help
I have something like:
"Hey, this is a title! Come & read me =)))"
it should be regexed to something like:
hey-this-is-a-title-come-read-me

Here is the code for php; may someone help me with perl, please?

public static function getTitleForUrl($title)
{
$title = strval($title); // makes a string
...
$title = strtr(
$title,
'`!"$%^&*()-+={}[]<>;:@#~,./?|' . "\r\n\t\\",
' ' . ' '
); // substututes the signs; i dont understand the long empty values.
$title = strtr($title, array('"' => '', "'" => '')); // substitutes all " and ' to nothing

$title = preg_replace('/[ ]+/', '-', trim($title)); // substitutes spaces and trim?
$title = strtr($title, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); // why not lowerchar?
...
return $title;
}
Subject Author Views Date
Thread Regex Help Robert 5317 Oct 13, 2017, 4:13 AM
Thread Re: [Robert] Regex Help
Robert 5196 Oct 13, 2017, 4:42 AM
Post Re: [Robert] Regex Help
el noe 5180 Oct 13, 2017, 5:23 AM
Thread Re: [Robert] Regex Help
Andy 5177 Oct 13, 2017, 8:56 AM
Thread Re: [Andy] Regex Help
Robert 5175 Oct 13, 2017, 9:06 AM
Post Re: [Robert] Regex Help
Robert 4769 Dec 9, 2017, 2:57 PM