Artificial intelligent assistant

How can I increase a number found by wildcard in the previous command? (zsh) I want to accomplish this: setopt HIST_SUBST_PATTERN echo Ninja_Turtles_2003_S02E05_DVDRip_30NAMA.mkv ^E(0?)^E$((match[1]+1)) # resulting in: echo Ninja_Turtles_2003_S02E06_DVDRip_30NAMA.mkv ‌But I get: echo Ninja_Turtles_2003_S02E1_DVDRip_30NAMA.mkv I tried `^(#b)E(0?)^E$((match[1]+1))`, but it didn't work.

You need the `extendedglob` option for `(#b)`.

Also `05 + 1` yields `6`, not `06`.

You could do (with `extendedglob` and `histsubstpattern`)


^(#b)E(<->)^E${(l:2::0:)$((match[1]+1))}


Or:


echo ${_//(#b)E(<->)/${(l:2::0:)$((match[1]+1))}


* `<->` is a form of `` positive decimal number matching operator where both boundaries are omitted, so matches any non-empty sequence of decimal digits. Same as `[0-9]##` (though `##` needs extended-glob while `` doesn't).
* `(l:2::0:)` (note that it's a lower case L, not the `1` digit) is the left-padding parameter expansion flag, here with `0`s, of length `2`.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 14e82355fe9f03ebd0a084f99973725c