About Google Code Search
Frequently Asked Questions
- What kind of code are you crawling?
- What regexp syntax does Code Search support?
- What programming languages do you support?
- How do I restrict by language, license or filename?
- Can I add Google Code Search results to my website, IDE or application?
- How do you decide what software license to list for a piece of code?
- How do I add my code to Google Code Search results?
- How do I make sure you have the correct language and license for my code files?
- How do I block you from crawling my code?
- I have suggestions for product improvements. How do I let you know?
- How do I let Google know if I see a Code Search result that I think should be removed?
Google Code Search helps you find function definitions and sample code by giving you one place to search publicly accessible source code hosted on the Internet. With Google Code Search, you can:
- Use regular expressions to search more precisely
- Restrict your search by language, license or filename
- View the source file with links back to the entire package and the webpage where it came from
| Frequently Asked Questions
1. What kind of code are you crawling?
We're crawling as much publicly accessible source code as we can find, including archives (.tar.gz, .tar.bz2, .tar, and .zip), CVS repositories and Subversion repositories.
2. What regexp syntax does Code Search support?
Google Code Search supports POSIX extended regular expression syntax, excluding backreferences, collating elements, and collation classes. To search for a space character, escape it with a backslash, as in
hello,\ world. You can search for literal strings by enclosing the strings in quotation marks, as in
We also support the following Perl extensions:
|Matches a word character. (alphanumeric plus "_")
|Matches a non-word character.
|Matches a whitespace character.
|Matches a non-whitespace character.
|Matches a digit character.
|Matches a non-digit character.
3. What programming languages do you support?
The Advanced Code Search page lists the programming languages we're able to detect. But even if your language of choice isn't on there, you can still search for code written in that language. We make as much code searchable as possible, including code where we can't detect the language. When we're able to detect the programming language for a file, we indicate that in the search results, and you can restrict your search to code written in that language.
If we're not detecting a language you care about, the
file: operator can be useful to search for files with a specific extension. For example, you could restrict your search to files with a
.abc extension with a query like
myquery file:\.(x|abc)$. If we're not detecting a language you think is important, be sure to let us know.
4. How do I restrict by language, license or filename?
You can either use the Advanced Code Search page or use our operators. Our operators include:
The argument to each of these operators can be either a quoted literal string or a regular expression. As illustrated in some of the examples above, each of the operators can be used as a negative by placing a minus sign ("-") in front of it.
lang: operator, which restricts by programming language (e.g.,
license: operator, which restricts by software license (e.g.,
package: operator, which restricts by package URL (e.g.,
file: operator, which restricts by filename (e.g.,
5. Can I add Google Code Search results to my website, IDE or application?
Yes. Code Search results are available via a GData/XML feed, and we encourage you to help create IDE plugins and add Google Code Search to your site.
6. How do you decide what software license to list for a piece of code?
We do our best to determine the software license for code packages by looking for a license in the comments or in a separate license file (e.g.,
COPYING). If we can't find a license, we indicate that the license is "Unknown." Please note that our license detection is not perfect -- we try to list the license as indicated by the code's author, but we can make mistakes and sometimes the author indicates the wrong license. The Code Search results also can't tell you what patents may cover a piece of software. We tell you what we can about the likely license terms, but understanding the legal requirements to reuse a piece of code is your responsibility.
7. How do I add my code to Google Code Search results?
You can submit your code using our online form. If you have a lot of code to submit, you may want to create a Code Search sitemap, which provides a way to specify all the code files on your site. Please note that we do not add all submitted code to our index, and we cannot make any predictions or guarantees about when or if it will appear.
8. How do I make sure you have the correct language and license for my code files?
You can create a packagemap file that specifies the language and license for each file inside a package. Create the file using the packagemap XML format and then place that file in the top-level directory of the code archive.
9. How do I block you from crawling my code?
Google Code Search respects
robots.txt, so there are a couple ways you can block us from crawling your code:
Please note that it may take some time for Code Search to update its index and remove your code. If you have an urgent request, please let us know by emailing firstname.lastname@example.org.
- If you have access to the robots file for your web server, you can add the code's path to the
Disallow: line. Learn more.
- Alternatively, you can simply put a robots file in the root directory of your code package. This will work for both archives and source control repositories like CVS and Subversion. For example, to indicate you want none of your code crawled, you could add a file called
robots.txt in the root directory with the following:
10. I have suggestions for product improvements. How do I let you know?
To share your thoughts with us, please post them to the discussion group. Google Code Search is part of Google Labs, so we're still in the early stages of development. Your feedback is important and will help us improve the product.
11. How do I let Google know if I see a Code Search result that I think should be removed?
Google Code Search is still in Google Labs, so the search results may not be perfect. If you notice a significant problem with the search results, please let us know by emailing email@example.com. If you're a copyright owner and believe you've found results that infringe your copyright, please follow our DMCA process to request removal.
Please refer to the Google Code terms of service.