I want this to work (it needs extendedglob and histsubstpattern):
alias ri='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' But it doesn't:
$ alias sss='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' $ echo /Users/evar/Downloads/Video/Teenage_Mutant_Ninja_Turtles_2003_S02E01_DVDRip_30NAMA.mkv /Users/evar/Downloads/Video/Teenage_Mutant_Ninja_Turtles_2003_S02E01_DVDRip_30NAMA.mkv $ sss zsh: command not found: Pocket I wouldn't mind using a function instead of an alias, but the result was the same.
I even tried export ss='^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' and then doing $ss, but that failed with zsh: command not found: ^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}.
Using eval '^(#b)E(?)^E${(l:2::0:)$((match[1]+1))}' also fails with zsh: command not found: Pocket.
Update: Related (possibly duplicate) questions found:
Alternative of bash's `history -p` in zsh?
https://stackoverflow.com/questions/27494753/how-to-get-last-command-run-without-using
https://stackoverflow.com/questions/48696876/using-history-expansion-in-a-bash-alias-or-function