Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think it would be a great idea if we had a regular expression search engine, but can it be done? It seems impossible since there's no feasible way of indexing such a huge amount of data properly and displaying results in the order of relevance from what I can think of.

I'm curious what the answer to this one would be.

share|improve this question
up vote 8 down vote accepted

It can be done, and it has been done:

I think it is useful here because this is in a specific domain where the users might be expected to understand regexes. I suspect in general the feature is not that useful to the vast majority of Google users so there is probably no commercial reason to do it.

share|improve this answer
This is great but the source code on codesearch is a very tiny fraction of the web pages indexed by Google. I suspect there are some limitations because the commercial reason argument isn't that strong (they do have a number of useful keywords like site, filetype, intitle, inurl etc.). I think the load on their servers would be too great for regex searches. – altvali Apr 28 '11 at 10:48
If Google thought Regex would be useful to enough people they could scale. They scaled for instant answers, that was a huge effort. Search is worth billions of $, if regex gave them an advantage they would do it, but 99% of users have no idea what a regex is, so it is simply not worth the effort. – Steve Haigh Apr 28 '11 at 10:50
Google doesn't shy away from throwing hardware at a problem. – JeffO Apr 28 '11 at 12:04
Note that Google Code Search is being retired. – MετάEd Nov 8 '11 at 21:05
has been retired now! – Vaibhav Garg Feb 9 '12 at 11:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.