title: Using preg_replace and str_ireplace
body: <p>Here's a copy of my current code:</p>
  
  <pre><code>&lt;?
  function smarty_modifier_url(&amp;$url) {
  
      //remove html tags
      $url = strip_tags($url);
  
      trim($url);
      $url = preg_replace ( '%[.,:\'"/\\\\[\]{}\%\-_!?]%simx', ' ', $url );
      $url = str_ireplace ( " ", "-", $url );
      return $url;
  }
  ?&gt;
  </code></pre>
  
  <p>This code is modifying URLs that are shown on my website.  Here's a copy of one of the URLs:</p>
  
  <pre><code>http://example.com/listing/1/Testing-|-See-If-This-Works-
  </code></pre>
  
  <p>What would I need to change in the code above to remove <code>|</code> from showing in URLs and to remove the <code>-</code> at the end of the URL?  Any help would be appreciated.</p>