I'd like to search for phrases using regular expressions on sites such as Wikipedia and Wikimedia Commons. Is it possible to do this?

Example regex search query: (facebook|google) (corporate history|websites)

It's already possible to do the same on Google (as demonstrated here), so I want to know whether it's possible for Wikipedia as well.

  • Would you be willing to download several gigabytes of data and do all of the filtering on your own computer? – svick Aug 2 '12 at 19:46
  • It appears that is possible to do this using AutoWikiBrowser: en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/… – Anderson Green Aug 2 '12 at 19:46
  • You can use AWB to search a certain page (or a set of pages), but not the whole wiki, which I was assuming is what you wanted. – svick Aug 2 '12 at 19:48
  • Yes, I wanted to search the entire wiki. Are there any tools on the toolserver for this? – Anderson Green Aug 2 '12 at 19:50

It is possible to search Wikipedia (or any other site that a search engine can access) using simple regular expressions, as long as you rely on an search engine. The following Google search query searches Wikipedia for matches of the regular expression (Yahoo|Google|Microsoft):

https://www.google.com/#hl=en&sclient=psy-ab&q=site:en.wikipedia.org+(google+OR+yahoo+OR+microsoft)&oq=site:en.wikipedia.org+(google+OR+yahoo+OR+microsoft)&gs_l=hp.3...87411.96861.2.97076.26.24.2.0.0.0.79.1141.24.24.0...0.0...1c.1.7.psy-ab.s2oGD_2LKy4&pbx=1&bav=on.2,or.r_cp.r_qf.&bvm=bv.44158598,d.dmg&fp=dc8abc04c054405e&biw=1366&bih=639

If you're only interested in doing a regex search of Wikipedia titles, Crossword Nexus allows you to do that. http://crosswordnexus.com/wiki

It's available and powered by the CirrusSearch (based on ElasticSearch) which is the used search engine in the MediaWiki sites, and the Wikimedia platform.

Some usage examples:

Note: Full guide reference, and source - on Wikipedia: Help:Searching#Search_string_syntax.

As for your question:

Logical operators

The search engine supports boolean logic in searches. The logical operators include the "-" (minus sign) character for "logical not", the AND, the OR, and the grouping parentheses brackets: (_).

Logical OR must be spelled in capital letters; the AND operator is assumed for all terms (separated by spaces), but capital AND is equivalent.

More examples:

  • Simple AND, OR: "credit card" OR "payment card", "credit card" AND "payment card" - will work as expected.
  • Suffixed tilde character for fuzzy search ("sounds like") - For example, searching for charlie~ parker~ returns Charlie Parker, Charles Palmer, Charley Parks (up to two character difference, not including the first one).
  • Wildcard search - searching face*e - starts with face and ends with an e with anything in the middle. enter image description here

Extra reading

Read more about the search engine and this extension to unveil their full functionality and features.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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