82

It would be very useful if Google provided a regular expression search.

Is there a way to do this?

I am not talking about search operators like site:, filetype:, AND, OR or "Text". I would like to search with a regular expression like .+[]^).

For example, is there an application, a site or a Google tool to search things like *.stackexchange?

0

7 Answers 7

31

This feature is not available in classic Google Search and it's not in Google's roadmap. You can learn more about this topic watching the Google video Will Google implement the ability to search with regular expressions?

However, there was one exception. Google Code Search (http://www.google.com/codesearch) supported regular expressions. Of course, the search target for this topic search engine was reduced to source code only.

It is worth mentioning that some Google search keywords can partially replace regular expressions. For example, if you want to search any two-word variation of "search TERM", you can use the wildcard operator.

search *

will find results for search and any other (one) word. I often use it to check basic English grammar rules or synonyms (e.g., "as easy as *").

2
13

Google Search can return the matches of patterns that resemble regular expressions. For example, the search query

"(gray|red) (wolf|fox)"

appears to be equivalent to

("gray wolf" OR "red fox" OR "red wolf" OR "gray fox")

You can see the output of this search query here.

Google Search also allows "wildcard" characters in search strings, so you can find search results for patterns like "the quick brown * (jumped|jumps) over the * dog".

3
  • The claim that a query using Google Search OR operator is using a regular expression is misleading.
    – Rubén
    Oct 14 at 23:04
  • @Rubén The search operators don't support most of the features of regular expressions, but I thought this particular example ( (gray|red) (wolf|fox) ) worked like a regular expression. Does this search query not only show results that include matches of that regular expression? Oct 15 at 2:16
  • Nowadays * and | aren't search operators. More details in my answer to Where to find a list of Google search operators?
    – Rubén
    Oct 28 at 22:35
8

You can write a piece of software to:

  1. Take the keywords from the regular expression;
  2. Google the keywords and get a list of results;
  3. Crawl each resulting URI and filter it with complete regular expression.

Let's study a case: from site:gog.com find all games that have Spanish voice-over.

The regular expression is:

Audio[^:]*:[^.,]*Spanish

It shall match, for example:

Audio lanuage: English, German, Spanish, French.

And not match:

Audio language: only-English. Text language: Spanish.

Step 1. Let your software search this on Google:

site:gog.com audio Spanish inurl:game

inurl:game here means only search in game description pages

Step 2. Get the 300 resulting links and crawl into every one of them.

Step 3. Filter the result with the given regular expression:

Audio[^:]*:[^.,]*Spanish

This should be easy to build. In fact I don't understand why I couldn't find something that is already built that way.

Since search engines can't afford the resource to scan their data with regular expression, this dirty job falls on your part, and your computer should do that with what search engines already provide.

0
4

No, unfortunately not :(. In theory you could make your own search engine and do it, but that would be pretty hard.

1

Just for reference, Google's help on search operators is here.

Interestingly, "-" is still an operator for word exclusion, but they removed "+" as an operator, used in the past to require a given search term. Apparently, "The + operator was retired when Google+ was launched, because + was needed as a searchable character rather than an operator."(https://support.google.com/websearch/answer/2466433)

1
  • The linked help article is still being referred to as the most current documentation for end-users but it looks more as comment than an answer.
    – Rubén
    Oct 28 at 22:45
0

However, there's one exception. Google Code Search supports regular expressions. Of course, the search target for this topic search engine is reduced to source code only.

There are actually two exceptions: You can run Google Script type regex searches in Google Drive. Example: /\d{3}\-\d{3}\-\d{4}/

Maybe someday they'll carry that over to web search.

1
  • This answer is obsolete, and the second part doesn't answer the question. By Google, the OP is referring to the Web Search, not to the company.
    – Rubén
    Oct 28 at 22:38
-4

If you know VBA, you can write some code to get data from the web to Excel. I run the program day and night and can get millions of results. After that you can filter from those results.

1
  • The core of this idea is not limited to VBA. It might be done using almost any programming language. You should have included more details to make it clear what might be the advantages if you were thinking of automating Internet Explorer, probably this answer is obsolete nowadays.
    – Rubén
    Oct 28 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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