I am running up against a weird problem here. When I run:
"#/a/b/c/d".replace("#\/","")
I get what I would expect: a/b/c/d
.
But When I precede this regex with a start of string character ^
, To get:
"#/a/b/c/d".replace("^#\/","")
This returns the original string "#a/b/c/d"
.
Could anybody explain why the hash isn't removed and possibly suggest an alternative that would remove the hash only if it appears at the beginning of the string?