---
schema_version: "1"
id: 878267c4b66783b66c4ae14d5249061cbf2209cfce9999b736a90ac02643c0c1
title: Using Bounds
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_classes_pattern_and_matcher_bounds.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_pattern_and_matcher_bounds.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 719b61dda54fe80d4a88e4d73530e5666d2006931a3f679f84187b7b1c0f28c9
---
# Using Bounds

By default, a region is delimited by anchoring bounds, which means that the line anchors (such as ^ or $) match at the region boundaries, even if the region boundaries have been moved from the start and end of the input string. You can specify whether a region uses anchoring bounds with the useAnchoringBounds method. By default, a region always uses anchoring bounds. If you set useAnchoringBounds to false, the line anchors match only the true ends of the input string.

By default, all text located outside of a region is not searched, that is, the region has opaque bounds. However, using transparent bounds it is possible to search the text outside of a region. Transparent bounds are only used when a region no longer contains the entire input string. You can specify which type of bounds a region has by using the useTransparentBounds method.

Suppose you were searching the following string, and your region was only the word “STRING”:

This is a concatenated STRING of cats and dogs.

If you searched for the word “cat”, you wouldn't receive a match unless you had transparent bounds set.