Searching code on Github (web)
-
- Posts: 505
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Searching code on Github (web)
Hi,
a stupid question: is anyone aware how to search for source code on Github (web)?
It seems that Github can only find exact words (case insensitive), or terms including the searched query extended with "_" (underscore).
Partial matches are not detected. Is that right?
For example, I want to find all words containing the term "debug" in a specific repository.
If I only enter "debug", then "debugPorts" is not found, but "debug_port" is found.
What should I enter in the search field in order to also find "debugPorts"?
a stupid question: is anyone aware how to search for source code on Github (web)?
It seems that Github can only find exact words (case insensitive), or terms including the searched query extended with "_" (underscore).
Partial matches are not detected. Is that right?
For example, I want to find all words containing the term "debug" in a specific repository.
If I only enter "debug", then "debugPorts" is not found, but "debug_port" is found.
What should I enter in the search field in order to also find "debugPorts"?
Re: Searching code on Github (web)
Have you tried standard match all operators such as %? Not something I've tried btw.
Re: Searching code on Github (web)
I got several times the same issue than you.
And it seems not possible to find using a pattern.
You can try using this:
https://github.com/search/advanced
Here the consideration for search with all the restrictions:
https://help.github.com/en/github/searc ... ode-search
And it seems not possible to find using a pattern.
You can try using this:
https://github.com/search/advanced
Here the consideration for search with all the restrictions:
https://help.github.com/en/github/searc ... ode-search
-
- Posts: 505
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Searching code on Github (web)
Thanks Frederic, I have already read all those links and many more, but none of them provided answers to my issue.
That is why posted here in the hope that some has a solution.
But it seems that the usage of match operators is not supported, so I think we have to live with this restriction.
That is why posted here in the hope that some has a solution.
But it seems that the usage of match operators is not supported, so I think we have to live with this restriction.
Re: Searching code on Github (web)
Right.stevestrong wrote: Thu Mar 26, 2020 2:01 pm But it seems that the usage of match operators is not supported, so I think we have to live with this restriction.

Re: Searching code on Github (web)
Can you use Google or some other search engine to do what you need?
For example put this in google..
... and you will see all of the instances of that string on the whole of github.
Modify it to
And you will only see the commit in my repo.
For example put this in google..
Code: Select all
TFT.print(" STM-O-Scope by Andy Hull") ; site:github.com
Modify it to
Code: Select all
TFT.print(" STM-O-Scope by Andy Hull") ; site:github.com/pingumacpenguin/STM32-O-Scope +commit
-
- Posts: 505
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Searching code on Github (web)
Andy, the problem is with the incomplete word search.
You cannot search only for
it will be not found.
You cannot search only for
Code: Select all
TFT.print(" STM-O-Sco
Re: Searching code on Github (web)
You could try duckduckgo instead, it does produce results for that search term.
Enter the search you mentioned.
This expands to the following in the search URL
.. which produce stuff. Whether these are the droids you are looking for I don't know.
Code: Select all
https://duckduckgo.com
Code: Select all
TFT.print(" STM-O-Sco site:github.com/pingumacpenguin/STM32-O-Scope
Code: Select all
https://duckduckgo.com/?q=TFT.print(%22+STM-O-Sco+site%3Agithub.com%2Fpingumacpenguin%2FSTM32-O-Scope&t=canonical&atb=v192-1&ia=web
Re: Searching code on Github (web)
.. better still, duckduckgo supports Unix style string escaping, so try this string
Note the "Escaped" double quote in the string.
Code: Select all
"TFT.print(\" STM-O-Sco" site:github.com/pingumacpenguin/STM32-O-Scope
-
- Posts: 505
- Joined: Fri Dec 27, 2019 4:53 pm
- Location: Munich, Germany
- Contact:
Re: Searching code on Github (web)
Thanks, it looks much better with duckuck, but it is still not perfect.
I do not see directly the line where the text occurs. Of course the additional CTRL+F on the page helps further.
But: why do I get results from Bodmer's repo when I search the whole github?
I do not see directly the line where the text occurs. Of course the additional CTRL+F on the page helps further.
But: why do I get results from Bodmer's repo when I search the whole github?