Google syntax refers to the exact language used for searching through web documents using the Google search engine, found at http://www.google.com.
About This Writeup
Whenever you see an entry like this:
Everything OR nate
... you can directly insert this into the text box found at http://www.google.com to try the syntax for yourself.
To execute the most basic search at Google, visit http://www.google.com and type in a single term. For example, you could go to Google and search for
This returns about 10,500,000 matches. This is the number of times the word "Iraq" is found in the web pages stored in the Google archive.
Google is case insensitive when it comes to searching. So, a search for
or a search for
will retrieve the same set of results.
You can expand on this search by searching for multiple terms. For example, typing in
... executes a search for all pages that contain the words Saddam and Hussein. This is by default; whenever you put in a list of words, Google by default searches for pages that contain ALL of the words you searched for. This is useful when searching for names, like in this example.
The OR Operator
If you want to search for pages that contain either one term or another, you can do this by using the OR operator (note that OR is in all caps; it must be that way for the operator to work). For example, if one wanted to find all of the pages containing the word Iraq or the word Hussein, one would type in
Iraq OR Hussein
If you prefer, you can substitute the word OR in the above string with the pipe character, |. In other words, the query below means exactly the same thing as the query above:
Iraq | Hussein
If you are looking for an exact phrase or sequence of words in Google, you place the words inside of quotation marks, like "this." So, if you wanted to find the exact phrase Saddam Hussein inside of Google, instead of all pages containing Saddam and Hussein, you would type in
You can combine this with the other operations described above to make a more complex query. For example, if you wanted to find all pages that used the term Iraq or the exact phrase Saddam Hussein, you could type in
Iraq | "Saddam Hussein"
Let's say, for example, that you wanted all pages that definitely included one term as well as any one of several other terms. This situation is accounted for in Google using parentheses. For example, let's say you want all the web pages that contain the term Iraq, but also contain either the phrase Saddam Hussein or the phrase Tariq Aziz. The exact query would look like the following:
Iraq ("Saddam Hussein" OR "Tariq Aziz")
Be careful when you try to do complex things involving parentheses; if it doesn't make syntactic sense, Google will throw out parentheses. For example, the following query:
Iraq OR ("Saddam Hussein" "Tariq Aziz")
This query can have several different meanings depending on the order of operations. To avoid this, Google simply strips the parentheses. A more correct version of the above query would be:
(Iraq "Saddam Hussein") OR (Iraq "Tariq Aziz")
... which gives a smaller result set. It should be noted that in most cases, you'll find the pages you want regardless of which version of the query you use.
Let's say we want to exclude particular words from our search. For example, let's say we wanted all pages with the phrase Saddam Hussein that do NOT include the word Iraq. This can easily be done using the - operator:
"Saddam Hussein" -Iraq
You can put the - in front of whole phrases; for example, if you wanted pages about Iraq that don't mention Saddam Hussein:
Iraq -"Saddam Hussein"
Google supports the use of * as a full-word wildcard. For example, let's say we are looking for information on the Fabulous Rougeau Brothers, but we don't have the faintest idea how to spell Rougeau:
"Fabulous * Brothers"
Note that the * operator is useless unless you are searching for phrases (i.e., the phrase is within quotation marks).
Also, Google does not support wild cards in the middle of words. For example, a search for
will NOT match Saddam Hussein. It will, however, find pages containing the string "Sad" and the string "Hussein".
Google also contains a number of special phrases that can help you in your searching and also into your investigation into specific web sites.
Putting the string cache: in front of a URL and searching for it within Google returns the Google cache of that particular page; in other words, the version of the page stored by Google. For example,
returns a cache of Slashdot. If you search for a URL for which the webmaster has instructed Google to not keep caches, you will simply get the normal search results for that page (as with everything2).
Putting the term daterange: in front of a pair of specially-formatted dates allows you to retrieve only pages that Google has cached within that date range. Google uses the Julian calendar for the date for this range, not the Gregorian calendar that you're used to. What does that mean? It means that the date used in the daterange: takes on a form that's quite unusual to those unfamiliar with the Julian calendar. For example, to find pages containing Tariq Aziz that Google indexed between March 9, 2003 and March 22, 2003:
daterange:2452707-2452720 "Tariq Aziz"
You can use this to restrict yourself to retrieve only recently updated pages, which is particularly useful if you're seeking to find a piece of recently updated information.
Putting the term filetype: in a search field along with a filename extension allows you to search through files of that type. In addition to typical HTML page types, such as html, php, pl, or cgi, you can also search through Acrobat documents using pdf, or various Microsoft extensions: doc, xls, and ppt. For example, searching for
"Saddam Hussein" filetype:ppt
finds PowerPoint presentations containing the term Saddam Hussein.
Putting the string inanchor: in front of a particular term makes Google search for pages that contain that term only within the anchor text for links on that page. Anchor text refers to the actual text one clicks on to reach another page, or in HTML, <a href="someurl">This is the anchor text</a>. For example,
inanchor:"Saddam Hussein" (Iraq OR "Tariq Aziz")
searches and locates pages that have a link containing the phrase Saddam Hussein, as well as containing either the word Iraq or the phrase Tariq Aziz.
Using info: followed by a URL as your search term makes Google retrieve a basic set of information about the page, such as the Google cache of the page, pages that link to the given page, pages that are similar to the given page, and other such utilities. You can execute this for, say, kuro5hin by entering:
This will return the stored Google information about kuro5hin.
Putting the string intext: in front of a particular term makes Google search for pages that contain the given term within their text only, ignoring links, URLs, and titles. For example,
intext:"Tariq Aziz" Iraq
finds only pages that have the phrase Tariq Aziz within the text that also have Iraq occurring anywhere. There is also an allintext: option which requires that all of the terms searched for appear only in the text (i.e., anywhere but the URLs, links, and titles). So,
allintext:"Tariq Aziz" "Saddam Hussein" Iraq
finds only pages where the phrases Tariq Aziz and Saddam Hussein and the word Iraq appear in the text of the page only.
Putting the string intitle: in front of a particular term makes Google search for only pages that contain that term. For example,
intitle:"Saddam Hussein" "Tariq Aziz"
finds pages that have the phrase Saddam Hussein in the title, as well as Tariq Aziz anywhere on the page. There is also an allintitle: option, which does not work with any other special phrases. Using allintitle: means that the entire rest of the query matches only on the page titles. In other words, it places intitle: in front of all of the terms in your query. For example,
allintitle:Iraq "Saddam Hussein" "Tariq Aziz"
returns only pages that have Iraq and Saddam Hussein and Tariq Aziz in the page title.
Putting the string inurl: in front of a particular term makes Google search for pages in which that term occurs in the URL for the page. For example,
inurl:help intitle:"Saddam Hussein"
matches all pages that have the word help in the URL and uses the phrase Saddam Hussein" in the page title, which would likely help you find pages providing help in dealing with Saddam Hussein. Replacing "Saddam Hussein" with a topic that you're having trouble with is a quick way to find specific help on that topic. As with intitle:, there is also an allinurl: option that makes sure that all terms are actually in the URL. So,
means that the URL must include both the term Saddam and the term Hussein.
Placing the string link: in front of a search term returns only pages that link to the URL that you provide. For example, searching for
returns pages that provide a link to E2. However, you cannot use this search in conjunction with others.
Putting the term phonebook: in front of a name or a phone number returns information about the number and the person or business associated with it. For example, searching for
phonebook:Jimmy Johns Ames, IA
returns the phone numbers and addresses of the Jimmy John's restaurants in Ames, Iowa. You can do the reverse; searching for
returns an entry for a particular Jimmy Johns franchise. The phonebook: search overrides any other searches you might include, so don't try mixing it with other searches.
Putting the term related: in front of a URL means that you will find pages that are somehow related to that URL. For example, to find pages related to E2:
This will turn up things like Wikipedia and Memepool. Google uses a number of algorithms to determine these relationships, usually utilizing the fact that one page links to the searched-for URL and the match. It's also very useful for digging up interesting related pages to your favorites. This doesn't work with other searches, however; you have to use related: without anything else.
Placing the string site: in front of a search term means that the search only digs through pages in the domain name you specify following this, such as everything2.com or msnbc.com. For example,
site:cnn.com intitle:"Tariq Aziz"
returns pages at cnn.com that contain the phrase Tariq Aziz in the title. site: also works with just small pieces of the URL; for example,
site:edu intitle:"Johns Hopkins"
returns pages in the .edu domain with the phrase Johns Hopkins in the page title.
More Special Syntaxes
Google adds new syntaxes on occasion; I will attempt to add these upon discovery.
Google Syntax and E2
The above search tools can allow you to easily dig up information that will help you with your searching. For example, I used several of the syntax descriptions in researching my recent writeup on the Bristol sessions:
intitle:Bristol "Ralph Peer" "Jimmie Rodgers" "A.P. Carter"
returned a set of six pages that provided a great deal of background reading and fact verification as I constructed the writeup from knowledge of the event. I only needed to know the names of three of the principal players as well as the fact that the sessions were held in Bristol and known as the Bristol sessions to develop the query. For another recent writeup on cultural imperialism, I wanted some agreement with my assessment of the Etruscan language as an example, so I searched for:
intitle:"cultural imperialism" Etruscan
and got a single match that helped with fact verification.
Good luck using Google with all of your searching needs!