Use regular expressions in promotions

If you want a promotion to appear for a variety of highly similar queries, you can use regular expressions to define your trigger queries. For example:

  • pizza \d{5,5} will match any 5-digit postal code queries, like "pizza 98102"
  • digital\scameras? will match the queries "digital camera" or "digital cameras".

To dynamically update a promotion URL or title with the content of a user query, use $q.


To add a promotion using regular expressions:

  1. On the Custom Search home page, click the search engine you want.
  2. Click Search features, and then click the Promotions tab.
  3. Ensure that Enable promotions is set to ON.
  4. To edit an existing promotion, click its name. Otherwise, click Add and create a new promotion.
  5. Select the Regular expression checkbox.

If the Regular expression checkbox is selected, Custom Search will treat everything typed in the search box (including commas) as a single regular expression.