Google Code Search for Public Source Code
Over the course of the evening Google Code Search went live as a search engine which has the purpose of finding pieces of public source code. Housed in Google Labs, Google Code Search my be the geekiest offering yet by Google as its foundation for searching and the serving of results is programming syntax.
Philipp Lenssen has a great write up about Google Code Search at Google Blogoscoped:
Google Code search has syntax unlike other Google searches. Normally Google acts fuzzy in that it ignores special characters. Google Code search is more precise (and naturally, it has a target group of people who are used to handling advanced precise syntax). A search for “hello, world” will return only matches with this exact string (including the comma and space). In fact, you have the full power of searching using regular expressions; search for ^hello and you’ll only get instances of “hello” that appear at the beginning of a line.
For starters, you can decide to search for swear words… which frustrated programmers tend to leave in the comments of their source code. There’s “Sucks” with 166,000 matches (like “DOS I/O *still* sucks”) or “I hate” with 13,400 results (including “Have I mentioned how much I hate DTDs?” or “i hate using globals!”). Search for the F-word, and you’ll get a couple of down-to-earth comments (like “as usual, IE is f*cked up”).
Another syntax specific to Google code search is the “lang” operator. Search for “lang:c” and you’ll only get snippets written in C. (This one seems to miss a couple of languages unfortunately.)