Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
Using Regions
A Matcher object finds matches in a subset of its input string
called a region. The default region for a Matcher object
is always the entirety of the input string. However, you can change
the start and end points of a region by using the region method, and you can query
the region's end points by using the regionStart and regionEnd methods.
The region method requires both a start and an end value. The following examples show how to set one value without setting the other.
Set the start of the region explicitly; leave end unchanged.
1MyMatcher.region(start, MyMatcher.regionEnd());Leave start unchanged; set the end of the region explicitly.
1MyMatcher.region(MyMatcher.regionStart(), end);Reset start to the default; set the end of the region explicitly.
1MyMatcher.region(0, end);