When I do a search bindkey in the zsh plugins directory for key conflicts I get responses from both the .zsh script files and .md files, and some of the zsh readme files use a double quote in the bindkey statement.How would I do a search for bindkeys using both ' and  for quoting? For instance if search for usage of Ctrl-R the first command using double quotes for the matching string produces the README.md of zsh-navigation-tools and single quotes produces the bindkey command for both vi-mode and zsh-navigation-toolsgrep -r -i 'bindkey ^r' ~/.oh-my-zsh/pluginsoutput:zsh-navigation-tools/README.md:    bindkey ^R znt-history-widgetgrep -r -i bindkey '^r ~/.oh-my-zsh/pluginsoutput:vi-mode/vi-mode.plugin.zsh:bindkey '^r' history-incremental-search-backwardzsh-navigation-tools/zsh-navigation-tools.plugin.zsh:bindkey '^R' znt-history-widgetHow can I create the command that will output all 3?Does grep have the option of specifying an alternate quoting character that will allow both ' and  as literals?
How can search for both single quotes and double quotes in a grep search?
shell;grep;regular expression;quoting;escape characters
Of course, you need to escape the ^ character:grep -r 'bindkey \^r' dirThen, you could use the Extended Regex Alternate character '|':grep -E 'bindkey \^r''|'bindkey '\^r  dirWhich could be reduced to:grep -E 'bindkey (|'')'\^r' dir [1]Or, if using bash, ksh or zsh, use the $' quoting (both ' and  could be escaped):grep -E $'bindkey (\|\')\^r' dirAnd, finally, realize that there are two r: r and R:grep -rE $'bindkey (\|\')\^(r|R)' dirOr use i (but that will change other characters also):grep -riE $'bindkey (\|\')\^r' dirOf course, this is also a perl regex (GNU grep):grep -rP $'bindkey (\|\')\^(r|R)' dir[1]It may be difficult to understand the quoting.But it is simply a concatenation of three quoted parts.A string quoted with single quotes followed by an string quoted with double quotes followed by a third string quoted again with single quotes. The easiest way to see the efect is to echo it. The shell will remove one quoting level and the string that the command actually receives becomes clear:$ echo grep -E 'bindkey (|'   ')   '\^r' dirgrep -E  bindkey (|   ')   \^r dirMaybe it would be easier to see with:$ echo grep -E 'a'b'c' dirgrep -E abc dirThe same could be written in one pair of single quotes.Remember that single quotes can not be included inside single quotes:$ echo grep -E 'bindkey (|'\'')\^r' dirgrep -E bindkey (|')\^r dirOr inside double quotes (a double quote could be escaped inside double quotes). With the added risk that some other characters ($, `, \, * and @) have an special meaning inside double quotes (not inside single quotes):$ echo grep -E bindkey (\|')\^r dirgrep -E bindkey (|')\^r dirAn alternative is to use a character list [] with \' and \:$ grep -E 'bindkey '[\\']'\^r' dirThat is still a three part string, but the middle is not quoted (and no spaces):'bindkey '    [\\']     '\^r'Hope this helps.