[UA] Square brackets [ ] and the hyphen -

Square brackets [ ]

Use square brackets to create a set of characters to match.

When you include a series of characters in brackets, your expression matches 1 of those characters.

For example, the expression PART[123] matches:

  • PART1
  • PART2
  • PART3

The expression doesn’t match:

  • PART12
  • PART23
  • PART123

Hyphen -

Use the hyphen along with the brackets to create a range of characters to match.

For example, if you need to match any uppercase letter, you can specify [A-Z].

If you need to match any digit, you can specify [0-9].

If you needed to match all of the part numbers above, you could use the following expression:

[A-Z]+[0-9]+

  • [A-Z] (matches any uppercase letter)
  • + (one or more times)
  • [0-9] (matches any digit)
  • + (one or more times)

Was this helpful?

How can we improve it?
true
Choose your own learning path

Check out google.com/analytics/learn, a new resource to help you get the most out of Google Analytics 4. The new website includes videos, articles, and guided flows, and provides links to the Google Analytics Discord, Blog, YouTube channel, and GitHub repository.

Start learning today!

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