The issue is probably that you are using the same pattern for bothRight, I know that, my code sample was too lazy. The only issue is with the egrep."apt-file search" and egrep, but they don't interpret it in the same way. By default, "apt-file search" does a literal substring match, so "\." will match backslash-period.
If there's no way for the shell to handle it, then that's just what I'll do. Still .... I'm almost sure I've had to deal with this before. IIRC every situation I've come up against has been handled by the right combination of quotes and backslashes ... I think.The function as presented cannot actually work with regex arguments, so just switch to "grep -F" and avoid the escaping issues altogether.
Please refrain from referring to zsh as "she". The shell is neitherSure. But things besides ships are feminized. Never mind. As you wish.a woman nor a ship.
No, egrep does not need the quotes.
% apt-file search zsh-theme | egrep --color=always zsh.
...
zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme
% apt-file search zsh-theme | egrep --color=always zsh\.
...
zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme
% apt-file search zsh-theme | egrep --color=always 'zsh.'
...
zsh-theme-powerlevel9k: /usr/share/powerlevel9k/powerlevel9k.zsh-theme
% apt-file search zsh-theme | egrep --color=always 'zsh\.'
[ no match ]
% apt-file search zsh. | egrep --color=always 'zsh\.'
...
zsh-doc: /usr/share/info/zsh.info.gz