Search
Clear search
Close search
Google apps
Main menu

The instructions in this help article may be affected by recent changes in the Analytics user interface. See this blog post for details. Help center updates are coming soon.

Question mark (?), plus sign (+), asterisk (*)

Question mark (?)

The question mark (?) matches the preceding character 0 or 1 times.

For example, 10? matches:

  • 1
  • 10
Example

Match an IP address with 1 or 2 digits in the last section.

For example, 255\.255\.255\.\d\d? matches:

  • 255.255.255.1
  • 255.255.255.10

This example uses the backslash to escape the decimal, and uses \d to match any digit.

Plus sign (+)

The plus sign (+) matches the preceding character 1 or more times.

For example, 10+ matches:

  • 10
  • 100
  • 1000
  • etc.
Example

Match an IP address with 1 or more digits in the last section.

For example, 255\.255\.255\.\d+ matches:

  • 255.255.255.1
  • 255.255.255.10
  • 255.255.255.100
  • 255.255.255.1000

This example uses the backslash to escape the decimal, and uses \d to match any digit.

Asterisk (*)

The asterisk or star matches the preceding character 0 or more times.

For example, 10* matches:

  • 1
  • 10
  • 100
  • 1000
  • etc.
Example

Match an IP address with 1 or more digits in the last section.

For example, 255\.255\.255\.\d* matches

  • 255.255.255.1
  • 255.255.255.10
  • 255.255.255.100
  • 255.255.255.1000

This example uses the backslash to escape the decimal, and uses \d to match any digit.

If you need to match more than just the preceding item, you can combine the asterisk with the dot (.*). The dot matches any preceding item, and then the asterisk will match that item zero or more times, which lets you match things like all URIs that begin and end with the same characters, regardless of how many characters are in between. For example, /mens/.*html matches:

  • /mens/shirts/oxford.html
  • /mens/shirts/oxford/shortsleeve.html
Was this article helpful?
How can we improve it?
Google Analytics training and support resources

Check out our comprehensive list to learn more about Analytics solutions.