Github Enterprise: How to find files containing only an exact term?

In Github Enterprise web interfice, if I select a repository enter say 10.136.40.222 in the search bar to the left of Pull Requests Issues - it will pull up files with all kinds of near misses like 10.136.40.200 10.136.40.170 10.136.40.111 10.136.40.222 10.136.30.222. So annyoying! 

If I put double quotes on the search term it finds nothing. Single quotes behave as if no quotes were put in.

Is there a magic string that will let me see ONLY those files containing the string 10.136.40.222??

Hi @gitmedmed,

Unfortunately, because of how GitHub Search handles tokenization, searching for IPs themselves is bound to be difficult. Content on GitHub is broken into chunks by the search index, and only these chunks (or “tokens”) are searchable. The search index tries to find natural word breaks to split at – like case transitions (e.g. “FooBarBaz”) or non-word characters (e.g. the hyphen in “jquery-tictactoe”).

In the first example, “FooBarBaz” would be broken into the following tokens: foobarbaz, and foobarbaz. Only those words will be searchable. Searching for foobar will not find occurrences of “FooBarBaz”.

In the second example, “jquery-tictactoe” would be broken into the following tokens: jquerytictactoe, and jquery-tictactoe. So searching tictactoe would match, but searching tictac would not.

Note that the search query itself is only tokenized on whitespace and punctuation, not on case transitions like the content that lives on GitHub. For example, if a user types “FooBarBaz” in the search bar, GitHub does not generate foobar, and baz tokens for the search query – They will only be searching for the one token foobarbaz. So they will find occurrences of FooBarBaz on GitHub, but they won’t find occurrences of FooBar.

Breaking on special characters

Most special characters are thrown out after being used by the tokenizer to split words. (See the full list in the Considerations for code search article.) They are not searchable, and there’s no way to escape them or change this behavior.

Hope this helps!

1 Like

Thank you! That will prevent any more head on the wall damage. :slight_smile:

So in its stead I’m downloading the repository to local computer and 

then I’m running Git Bash here out of Windows Explorer. That 

lets me use good ol’ grep. It would be better not to have those

extra steps but great to know I’m not missing something like

a special charater or backslash or something in the GUI search.