165

Google Code Search has been incredibly valuable to me as a developer - I use it a couple times a week to see how other developers have used (usually poorly documented) APIs. It's also convenient to see the internals of some of those APIs, or to find which API corresponds to the functionality you want (it's a great resource for Android in particular -- give it some of the text you see on screen, and it'll usually find the implementing class).

Now that Google shutting down code search as of January 15, 2012, are there any good replacements?

Nicholas Armstrong
  • 5,624
  • 2
  • 26
  • 18
  • 12
    As of 2013/03/07 it seems that `code.google.com/codesearch` is finally shutdown (now for real). Just a few days ago it was still reachable and usable, now above url returns a page 404 error. RIP codesearch. But `koders` is indeed a good alternative. – Andreas W. Wylach Mar 07 '13 at 08:57
  • 1
    Try GitHub Search at http://github.com/search – kenorb May 29 '13 at 11:33
  • 5
    The creator of codesearch released a detailed article about [how it all worked](http://swtch.com/~rsc/regexp/regexp4.html) and the source is available [here](https://code.google.com/p/codesearch/). Apparently, this can be run on one machine! Hopefully, this will get stood up by someone, somewhere, soon... – gMale Jun 28 '13 at 05:45
  • what about http://www.cocycles.com- it works with javascript and it's the only engine to understand functionality, so you can simply search for things like "hash map" or "parse headers" and find full implementations, docs, usage examples and more. – Yoni Feb 25 '16 at 12:50
  • I know this is an older thread, but now there's also https://exemplator.xyz/ which finds example usages for Java code (unfortunately only Java right now) - but it works well! – jundl77 Jan 06 '17 at 13:44
  • check out https://codegrep.com – codegrep_admin Dec 03 '18 at 21:46

4 Answers4

76

I have reviewed the following sites

The good

The broken or unsuitable

(I'll have to try these again later)

  • Antepedia (GitHub login broken as of 2016-08-23; no code search?)
  • SymbolHound (generic search engine, not just code)
  • Codase (only C, C++, Java; service unavailable as of 2016-08-23)
  • Codefetch (unreachable as of 2016-08-23)

The dead

When I originally did the review, Koders turned out to be the winner for my purposes, but I really liked the user interface and features of SymbolHound Code Search better. The only problem with SymbolHound was the small number of sites it has indexed. The search[code] engine was also promising at that time.

Many of the sites I've reviewed have since been discontinued completely or have disabled their code search functionality. Krugle and search[code] seem to be chugging along, and GrepCode is good if you live in the Java world.

That Brazilian Guy
  • 2,791
  • 4
  • 25
  • 46
akaihola
  • 24,161
  • 5
  • 52
  • 64
44

Take a look at these:

masoud
  • 51,434
  • 14
  • 119
  • 190
  • 1
    Open Hub Code Search has now been discontinued, but [Sourcegraph](https://sourcegraph.com) lets you search for code and see how other coders are calling/using libraries. (I'm affiliated with Sourcegraph.) – sqs Jun 14 '16 at 21:23
17

Another one to consider is http://searchcode.com/ It supports regex search as Google Code search does. For example,

http://searchco.de/?q=/[cb]at/
http://searchco.de/?q=/a{2,3}/
http://searchco.de/?q=/^import/
http://searchco.de/?q=/atoi/%20ext:c
http://searchco.de/?q=/dll$/

Are all valid searches.

Ben Boyter
  • 849
  • 9
  • 16
6

There is http://opensearch.krugle.org

Petr
  • 3,098
  • 16
  • 21