Im try replace
http://site.com/13/new new (2011).html
to
http://site.com/13/new_new_2011.html
Here is my code,
<a href="<?php echo $row->id;?>/<?=preg_replace('#[^\w\-]+#','_', strtolower($row->showTitle()))?>.html">
$row->showTitle() is a title like New New (2011)
but problem is because my links now looks like this
http://site.com/13/new_new_2011_.html
I need to remove last “_” from url _.html
Try this :
It will remove any trailing underscore.