Test regular expression patterns in Search Suggestion Exclusion List Rule entries

  • Release version: Yokohama
  • Updated July 31, 2025
  • 1 minute to read
  • Regular expression patterns are powerful and often require editing to get the correct behavior. When using regular expression patterns to exclude search strings, test the patterns thoroughly so as not to have unintended results.

    Before you begin

    Make sure you're familiar with Java's regular expression pattern syntax. To learn about regular expression pattern syntax, see the Javadoc for the java.regex.util.Pattern class.

    Role required: admin

    About this task

    The Exclusion List Rule and Search Suggestion Relations [m2m_blacklist_search_suggestion] table lists the suggestions eliminated from the Search Suggestion [sys_search_suggestion] table by entries in the Search Suggestion Exclusion List [sys_search_suggestion_blacklist] table.

    Procedure

    1. In your browser, navigate to https://<instance name>.service-now.com/m2m_blacklist_search_suggestion_list.
      A list of words excluded from search suggestions appears in the Exclusion List Rule and Search Suggestion Relations table. The Suggestion column shows the search string that was eliminated in the creation of suggestions.
    2. Add a regular expression pattern to the exclusion list table.
      For more information, see Preventing suggestions in special cases.
    3. In a search field, for example, on the ServiceNow® Service Portal, enter words that satisfy the regular expression pattern.
    4. Run the script that builds the search suggestions.
      For more information, see Schedule the Build Search Suggestions script. Select Execute Now to run the script immediately.
    5. In the m2m_blacklist_search_suggestion_list table, select the menu icon for the Exclusion List column heading, then select Group By Exclusion List to see the regular expression patterns and what they eliminated.
    6. Review the suggestions in the table to see if the regular expression patterns removed the suggestions they should have and no more.
    7. In the sys_search_suggestion_blacklist table, set an excluded regular expression pattern's Active field to false, then run the Build Search Suggestions script again to make sure that only excluded suggestions were removed.
    8. Revise the regular expression patterns if necessary and repeat the procedure.