MediaWiki Regex Search – How to Search MediaWiki Sites Using Regular Expressions

mediawikiregexwikipedia

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.

Best Answer

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.