Given the follow string:
/home/raulmelo/development/raulmelo-studio/node_modules/esbuild/lib/main.js
I wanted to remove EVERYTHING right after the world esbuild.
I could go with replace('/lib/main.js', '') but this is not future proof. What if in the future it changes to /lib/index.js?
So I came up with a regex to do that:
Internal server error