Search code examples
searchgithubescapingampersand

How to search for && as raw text in github


I'd like to search for code inside a github repository, which contains lines like this :

echo a && echo b

I'm trying to search && inside that repository, but I've got an error message :

We could not perform this search

The search contains only logical operators (AND / OR / NOT) without any search terms.

I can't manage to escape these ampersands. There is no match found, neither with \&\& nor '&&' nor "&&".

How can I perform that search ?


Solution

  • Since my previous answer, the GitHub help page has been updated.
    It does not seem possible:

    You can't use the following wildcard characters as part of your search query:

    . , : ; / \ ` ' " = * ! ? # $ & + ^ | ~ < > ( ) { } [ ]. 
    

    The search will simply ignore these symbols.

    So escaping (\&) or even &amp; don't work, because they include symbols which are ignored by the search query.