Mod Rewrite - Regex for Hiding #'s From Same-Page Link URLs

The title pretty much covers it. Could someone help me out with the regex for hiding the pound sign (#) and everything after it when the user clicks a link to an anchor on the same page? Thanks for any help!

Well, you’ll need to use javascript to achieve this because clicking a link with a hash (#) in it does not send a request to the web server. You’d have to place an “onclick” event handler on each of your anchors to call the following function:


function removeHash(e)
{

  if(e == null) {
    e = window.event;
  }

  var target = (e.target == null) ? e.srcElement : e.target;

  var new_url = target.href.replace(/#.*/, '');

}

new_url will contain your url with the hash and everything after it removed.

Hope this helps…