Looker Studio is now called Data Studio. Learn more about this change.

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 one of those characters.

For example, the expression PART[123] matches the following:

  • PART1
  • PART2
  • PART3

The expression doesn't match the following:

  • 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, 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).

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026年08月26日 UTC.