Yeah, this regex looks very odd. But it seems to do the job. I guess we should mention this in the documentation because “everything but” is a very common pattern especially when using trailingSlash and toCase.
Do you play Magic?
Get TopDecked MTG, the #1 Magic App, built by players, for players. Free to use, forever.