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 table provides examples of how to set one value without setting the other.
Start of the Region | End of the Region | Code Example |
---|---|---|
Specify explicitly | Leave unchanged |
|
Leave unchanged | Specify explicitly |
|
Reset to the default | Specify explicitly |
|