Jump to content

Little preg_replace trouble.


strago

Recommended Posts

$titleurl = preg_replace('/[^a-zA-Z0-9_ -%]/', '-', $d);
$titleurl = preg_replace('/[ ]/', '-', $titleurl);

 

How do you add to this to replace

 

---- with -

--- with -

-- with -

 

and remove quotes?

 

How do you remove a - if it's at the very end of $titleurl. For example, replace My-iPhone- with My-iPhone

Link to comment
https://forums.phpfreaks.com/topic/258327-little-preg_replace-trouble/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.