If you have `zsh`, that would be more easily and safely (and portably) done there: ``` autoload -Uz zmv zmv -n '(*-)[[:alnum:]]##_<->_<->(*.*)' '$1$2' ``` (remove the `-n` (dry-run) if happy). That's using shell globs (zsh ones with `extendedglob` enabled) instead of regular expressions though in terms of functionality you get the equivalent of extended regexps and more. - `*` is the usual matches any number of characters (or bytes if there are bytes not forming valid characters, one reason it's safer than (most) regexps - `[[:alnum:]]` is the standard matching by POSIX character class. - `##` is one or more of previous atom (like `+` in ERE/PCRE). - `<->` is any sequence of one or more ASCII decimal digits, like `<1-10>` but without bound. `zmv` will do a few sanity checks before starting the renaming making it safer than the various variants of `rename` around.