0

I'm currently trying to remove a guid id from a url, example provided below. It isn't removing the guid id, what am I doing wrong?

example url: "/something/9a2cd43-58c6-52e5-a0c1-700b462d613a"

window.location.pathname.replace(/\b[a-f\d]{32}\b/, '');
Brian Putt
  • 1,198
  • 2
  • 13
  • 32
  • 1
    You are missing a literal hyphen in your character class (`[a-f\d-]`) and your example is a 35 character string, so this won't work (because `\b` will be `13a` and that is not a word boundary). – Sam May 09 '14 at 19:40
  • Thanks for the clarification – Brian Putt May 09 '14 at 19:41

1 Answers1

3

You missed hyphen

\b[a-f\d-]{35}\b
Evgeny
  • 6,151
  • 8
  • 34
  • 42