Filter examples

 

Include only United States, Canada, or Mexico

Suppose you want to limit a chart's information to just data coming from the United States, Mexico, or Canada. Select the chart and add the following filter:

  1. Include/Exclude: Include
  2. Dimension: Country
  3. Match Type: IN
  4. Value: United States, Canada, Mexico

You could also do this using 3 OR clauses. But it's easier to use IN with a list.

Find data that contains the letter "c"

To find data that contains a value, you can use the Contains match type. For example:

  1. Include/Exclude: Include
  2. Dimension: Medium
  3. Match Type: Contains
  4. Value: c

This will match any values that contain the letter "c" anywhere.

Example:

organic
cpc
cpm
Facebook

Find data that ends with the letter "c"

The RegExp Match and RegExp Contains operators let you perform more complex matches. For example, to filter data that contains a value at the end of the data, you can use the end-of-line marker $:

  1. Include/Exclude: Include
  2. Dimension: Medium
  3. Match Type:: RegExp Match
  4. Value: .*c$

Example:

organic
cpc

Understanding the regular expression: .*c$

.* means "match anything" (including nothing),

then the literal letter "c"

$ means the "end of line" character. (To match the beginning of the string, use ^.)

Here's another example:

^c.*k.*$ would match text that begins with the letter c, followed by anything , followed by the letter k, followed by anything until the end of the string. This would match values like "cook", "cookie" and "cake".

Exclude data that doesn't begin with an alphabetic character

Regular expression character classes are a powerful shortcut for matching types characters. For example:

  1. Include/Exclude: Exclude
  2. Match Type:: RegExp Match
  3. Value: ^[[:^alpha:]].*

This will match any values that don't begin with a character in the "alpha" character class

Understanding the regular expression: ^[[:^alpha:]].*

^ means "beginning of string"

[[:alpha:]] is the alphabetic [A-Za-z] character class. [[:^alpha:]] negates the class ("not alphabetic")

.* means "match anything"

Google RE2 regular expression syntax.

Was this helpful?
How can we improve it?