Triggers tell DuckDuckGo on which search queries to initiate an Instant Answer. There are two types of triggers, words and regex.

The two types of triggers cannot be combined, but you may consider a third option of Regex Guards. We insist that you use word triggers whenever possible as they are simpler and faster.

Word Triggers

Word triggers specify what to look for, and where to look for it:

triggers <location> => <array of words and phrases>

For example:

triggers start => "stackoverflow", "stack overflow", "SO";

You may find the qw function convenient:

@triggers = qw(john jacob jingleheimer schmidt);
triggers any => @triggers;

You can also use multiple trigger statements together:

triggers start => "tv", "television";
triggers end => "schedule", "hours";

Word Trigger Locations

  • start — Word exists at the start of the query
  • end — Word exists at the end of the query
  • startend — Word is at the beginning or end of the query
  • any — Word is anywhere in the query

Note: You can combine several trigger statements if, for example, you want certain words or phrases to be startend but others to be start. The Average Goodie demonstrates the usage of multiple Word trigger statements.

Regex Triggers

We insist that you use word triggers whenever possible as they are simpler and faster.

Note that you cannot combine the use of Regex Triggers with Word Triggers.

Regex triggers specify which version of the query, and a regular expression to apply.

triggers <query_format> => <regular expression>


triggers query_lc => qr/trigger (?:my|your|our) instant answer/;


my $regex = qr/^this is an? instant answer regexp$/;
triggers query_raw => $regex;

Query Formats

  • query_raw — The query in its original form, with whitespace and case preserved
  • query — Uniformly whitespaced version of query_raw
  • query_lc — Lowercase version of query
  • query_nowhitespacequery with all whitespace removed
  • query_cleanquery_lc, but with whitespace and non-alphanumeric ASCII removed

Triggers in Multiple Languages

We have plans to make it possible to trigger Instant Answers in many different languages. Until an internationalization mechanism is place, to uphold maintainability and consistency, we cannot accept pull requests that add languages directly in the code.

results matching ""

    No results matching ""