I have a string like this:
dir/subdir/file-hash.ext
Knowing that the "hash" part in the above text is always 8 numbers/letters long, how can I make this string as shown below:
dir/subdir/file.ext
The only thing that may change is the string having or not a / at the beginning.
I have no idea how can i achieve this
.replace(/-\w{8}(?=\.)/, "")?