Advanced Search

Advanced Search will search the entire underlying HTML of an article rather than just the text. Use it to generate a list of articles containing any HTML element you desire and get a CSV list of matching articles.

When you run a search in your live knowledge base, in Knowledge Base > Manage, or using the Find Articles option in the lower left of many app pages, you run a text search. This is great for situations where you have a distinct phrase or word that appears in the text to search for.

But you may also want to run searches for:

  • Specific URLs
  • Specific HTML (such as color hexes or rgb values, certain classes, etc.)
  • Some underlying HTML elements, like iframes

In these cases, you really want to search the underlying HTML of your articles, not the text.

And these cases are exactly what we built Tools > Advanced Search for!

Here, you can search for an exact text string or use regex to find combinations of values.

Once you search, we'll search your articles in batches and generate a CSV export of all the articles we found that matched your search phrase.

See the options below to dig into this report in more detail.

Run an Advanced Search

To run an Advanced Search:

  1. Go to Tools > Advanced Search.
  2. Select your Search type:
    • Exact matches: good when you can enter the exact value or string you are looking for. This search is case sensitive.
    • Regex pattern: good when you are trying to find variations on a string. This search is case insensitive.
  3. Enter your Search Text. For an Exact match, this should be the exact string you are looking for. For regex, use regex patterns and escape special characters like / with a \ in front of them.
  4. By default, Advanced Search will search all articles with a Published or Needs Review status only. You can use the Additional content options to include draft or archived articles by checking the boxes next to them.
  5. Once you've finished your selections, select Search Knowledge Base to run the advanced search.
  6. A progress bar and article count will appear at the top of the page. While this advanced search is running, no one can run an additional advanced search.
  7. Once the search is complete, you'll see a confirmation message. The Last search ran on data and Text searched for will update, and you can select the Download button to download a CSV export of the articles we found that matched your search terms.

Exact match

The exact match is generally the best place to begin learning Advanced Search.

The exact match will look for an exact, case-sensitive word or phrase in your knowledge base.

You can add things like:

  • Link to Article references: Link to Article references get inserted as [[hg-id:articleid]]. Search for hg-id:id to find all articles that link to a given article
    • Example: hg-id:632b7cdc027d150f97264dfe
  • Topic article references: topic article references get inserted as [[ko-topic:id]]. You can run an exact match search for the ko-topic:id portion to find all places a topic article has been embedded
    • Example: ko-topic:632b7cdc027d150f97264dfe
  • Snippet merge code references: you can do a search for snippet.mergeCode to find all articles referencing a given snippet (though snippet references are usually a faster way to do this one!)
    • Example: snippet.contactUs
  • Exact URLs referenced as hyperlinks in your articles
    • Example:
  • Words that appear in the text of articles
    • Example: Advanced Search (or advanced search depending on case!)
  • Raw HTML like classes, hex codes, or rgb values
    • Example: search for the alert-success class
    • Example: search for a color used, like rgb(29, 40, 79) or #1d284f
  • Manually-inserted glossary terms: when you use the editor control to Add Glossary Term, this creates some underlying HTML that we can search, either to find all articles with manually inserted glossary terms, or with a specific manually-inserted glossary term
    • Example: find all articles with a manually-inserted glossary term by searching for the ko-glossary-term class: ko-glossary-term
    • Example: find all articles with a specific manually-inserted glossary term: data-glossaryid="5ad52bc9ad121c0453099161". (You'll need to know the ID of the glossary term--you can grab this by manually inserting it into an article and toggling to Code View!)

Tips on using this type of search

  • Since the search is case sensitive, be sure you're using values exactly as they appear in your knowledge base
  • Since this is an exact match, you do not need to escape special characters in any way: put them in exactly how they appear in your content
  • To search HTML, you may want to hop into Code View on an article to see exactly what you want to grab. For example, if I want to find every article where I've used an Alert Success div, I can search for the alert-success class using an exact match:

If you want to run a case-insensitive search or have familiarity with regex searches, see Regex pattern search for more information on running those searches!

Advanced Search regex pattern

If exact match won't get you what you need, the regex pattern should.

Regex is a common abbreviation of 'regular expressions'. Regular expressions are "a sequence of characters that specifies a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation." (from Wikipedia - Regular expression).

Regex can be very powerful, and can look very complicated. Don't panic!

There are basically two ways to use regex in our Advanced Search:

  1. To run a case-insensitive search
  2. To do a full regex pattern

For many of our authors, the case-insensitive search is all the further you'll need to go, so let's start there!

Regex for case insensitive search

For individual words or phrases that do not contain any punctuation, you can largely just run the regex pattern exactly as you would an exact match search.

If the word or phrase contains punctuation, though, you'll need to escape those characters by putting a "\" in front of them. This includes the following punctuation:

  • Forward slash: /
  • Plus sign: +
  • Asterisk: *
  • Question mark: ?
  • Square brackets, opening or closing: [ or ]
  • Parentheses, opening or closing: ( or )
  • Curly brackets, opening or closing: { or }
  • Dollar sign: $
  • Caret: ^
  • Equals sign: =
  • Exclamation point: !
  • Greater than and less than symbols: < and >
  • Vertical bar/pipe: |

So, for example, if I were adding a URL into the regex pattern search, I would want to add a backslash \ in front of any of any of the forward slashes /: becomes: https:\/\/\/knowledgeowl-support

Full regex patterns

Full regex patterns are generally best suited to advanced authors who are somewhat familiar with regex.

To construct your expression, we recommend using a tool like regex101, using the PCRE2 (PHP >=7.3) flavor of regex.

Then you can work with regex patterns to find what you're looking for. For more details on working with regex, you can check out:

  • W3 Schools PHP Regular Expressions: see the Regular Expression Patterns and Metacharacters sections
  • The Quick Reference guide within regex101 (be sure you have the PCRE2 (PHP >=7.3) flavor selected!)

An example:

  • "|" means "or" in regex, so you can search for one term or another by separating them with a |. We recommend placing the entire phrase in parentheses, particularly if you're using phrases rather than individual words.
    • Example: Search for articles containing either the word author or reader: (author|reader)
  • "." acts as a wildcard so you can use it in interesting ways.
    • Example: Search for articles that might contain either Berkshire or Cheshire by matching on shire with a wildcard: .shire

Tips on using this type of search

  • With regex patterns, it often helps to have an article you know should match the pattern to test against
  • If your word or phrase contains punctuation, remember to escape it using a \. See the list above in Regex for case insensitive search for more information.
  • Only use this search type if you can't get what you need from an exact match!

Reading the Advanced Search CSV

The Advanced Search CSV export contains 9 columns:

  • Object ID: This is a unique identifier we use behind the scenes to identify every object in your knowledge base. You can generally ignore this column.
  • Object Type: Advanced Search will search within articles and custom content categories. This column identifies whether the result returned is from an Article or a Category.
  • Title: The title of the article or category
  • Edit Link: A link to jump directly to the article or category within
  • View Link: A link to view the article or category in your live knowledge base
  • Parent Category: The title of the article or category's immediate parent category. This shows N/A if it is a top-level article or category.
  • Status: For articles, this displays the Publishing Status. For categories, this will display "active" if the category is active (deleted categories are not searched).
  • Author: The first and last name of the officially-identified author for the article. This will show as N/A for categories, since they have no listed author.
  • Last Modified Author: The first and last name of the author who last saved changes to this article or category.

Advanced Search video walkthrough

If you prefer video to text, here's Kate's original Wisdom Wednesday session on working with Advanced Search from August 30th, 2023.