0

I am building a bookmarklet to replace facebook.com/ with rillist.com/?id= what i'm using now is:

javascript:
  (function() {
    window.location=window.location.toString().replace(/facebook.com/,'rillist.com\?id=');
  })()

but that yields: http://www.rillist.com/?id=/example any idea on how to remove that pesky slash in order to yield: http://www.rillist.com/?id=example ? Thank you!

tripleee
  • 175,061
  • 34
  • 275
  • 318

1 Answers1

1

Your regex doesn't match the last forward slash.

Try changing the regex to this:

/facebook.com\//
Brian Ustas
  • 62,713
  • 3
  • 28
  • 21