This article is about Universal Analytics, which is going away. It's critical that you migrate your Universal Analytics property settings to Google Analytics 4, or you will begin to lose data on July 1, 2023 (July 1, 2024 for Analytics 360 properties). Learn how to migrate your settings.

Dot (.) and backslash (\)

Some characters have one meaning in regular expressions and completely different meanings in other contexts. For example, in regular expressions, the dot (.) is a special character used to match any one character. In written language, the period (.) is used to indicate the end of a sentence. In mathematics, the decimal point (.) is used to separate the whole part of a number from the fractional part.

Regular expressions first evaluates a special character in the context of regular expressions: if it sees a dot, then it knows to match any one character.

For example, the regular expression 1. matches:

  • 11
  • 1A

The regular expression 1.1 matches

  • 111
  • 1A1

If you were to provide an IP address as a regular expression, you would get unpredictable results. For example, the regular expression 0.0.0.0 matches:

  • 0102030
  • 0a0b0c0

In order to tell regular expressions to see the dot in its original context as a separator for the different parts of the IP address and not as a special character used to match any other character, you need to provide a signal to that effect. The backslash (\) is that signal. When regular expressions sees a backslash, it knows that it should interpret the next character literally. A regular expression to match the IP address 0.0.0.0 would be:

0\.0\.0\.0

Use the backslash to escape any special character and interpret it literally; for example:

  • \\ (escapes the backslash)
  • \[ (escapes the bracket)
  • \{ (escapes the curly brace)
  • \. (escapes the dot)
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue

Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
true
false
true
true
69256
false
false