I am encountering an issue with replacing URL parameters in my code.
Take a look at the following code snippet:
getTitle() {
const title = this.router.url.replace(/\D\//g, '');
return title;
}
However, it seems to only be removing numeric values. I actually need it to replace /
and any numeric value.
Specifically, what I want is for URLs like /project/1
to be transformed into just project
.
What mistake am I making here?